我们有一个Xamarin.Android项目,我们正试图在Mac上使用Jenkins构建该项目。解决方案文件包含几个不同的项目,其中之一是MonoDroid项目。MonoDroid项目依赖于解决方案中的其他项目。
我遇到的问题是,当我使用xbuild构建解决方案文件时,我无法使用/t:PackageForAndroid目标,因为它只对MD项目文件有效。
目前在Jenkins,我是这样做的:
xbuild MyCoolDroidAp/MyCoolDroidApp.sln /p:Configuration=Release /t:Clean
xbuild MyCoolDroidApp/MyCoolDroidApp.sln /p:Configuration=Release /t:Build
xbuild MyCoolDroidApp/MyCoolDroidProject.csproj /p:Configuration=Release /t:PackageForAndroid这是有效的,但在我看来,应该有一种方法来消除第三步。有谁有什么见解吗?
发布于 2013-04-11 05:04:25
围绕互联网的共识似乎是我正在以正确的方式做这件事。
发布于 2013-04-05 01:02:27
你不需要使用Xamarin.Studio/MonoDevelop来签署和压缩你的APK,你可以在命令行中完成。我很幸运地使用了rake to compile, sign, and zipalign my APK files。这样的东西对你有用吗?
如果做不到这一点,下面是一个简单的Powershell脚本,您可以很容易地将其移植过来:
# First clean the Release target.
msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:Clean
# Now build the project, using the Release target.
msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:PackageForAndroid
# At this point there is only the unsigned APK - sign it.
# The script will pause here as jarsigner prompts for the password.
# It is possible to provide they keystore password for jarsigner.exe by adding an extra command line parameter -storepass, for example
# -storepass <MY_SECRET_PASSWORD>
# If this script is to be checked in to source code control then it is not recommended to include the password as part of this script.
& 'C:\Program Files\Java\jdk1.6.0_24\bin\jarsigner.exe' -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore ./xample.keystore -signedjar
./bin/Release/mono.samples.helloworld-signed.apk
./bin/Release/mono.samples.helloworld.apk publishingdoc
# Now zipalign it. The -v parameter tells zipalign to verify the APK afterwards.
& 'C:\Program Files\Android\android-sdk\tools\zipalign.exe' -f -v 4
./bin/Release/mono.samples.helloworld-signed.apk ./helloworld.apk希望这能有所帮助。
发布于 2013-09-21 20:07:06
关于签名你的apk,我正在使用类似这样的东西作为我的makefile的一部分,它工作正常:
...
BUILD_DIR = ./builds/$(platform)
KEYSTORE_PATH = your_keystore_pass
STORE_PASS = your_keystore_pass
ANDROID_SDK_PATH = path/to/your/android/sdk/dir
#example ANDROID_SDK_PATH = /Developer/AndroidSDK
RES_APK = my_apk.apk
APK_NAME = my_signed_apk.apk
...
sign:
(cd $(BUILD_DIR); jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore $(KEYSTORE_PATH) -storepass $(STORE_PASS) result.apk $(STORE_PASS))
(cd $(BUILD_DIR); $(ANDROID_SDK_PATH)/tools/zipalign -v 4 result.apk $(APK_NAME))
(cd $(BUILD_DIR);rm result.apk)
(cd $(BUILD_DIR);rm $(RES_APK))希望这能有所帮助
https://stackoverflow.com/questions/15815601
复制相似问题