これは、JDK 1.6 から JDK 1.7 への切り替えが原因のようです。JDK 1.6 (場合によってはオプションではない) に固執する代わりに、 http: //developer.xamarin.com/guides/android/deployment,_testing,_and_metrics に基づいて、署名および整列された apk を作成するための小さなスクリプトを作成することをお勧めします。/publishing_an_application/part_1_-_preparing_an_application_for_release/
# 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 SHA1withRSA -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
重要な部分は、JDK 1.7 が予想されるダイジェスト アルゴリズムを使用するように強制するパラメーター-sigalg SHA1withRSA -digestalg SHA1
を使用することです (JDK 1.7 のデフォルトであり、すべての Android バージョンで受け入れられない SHA-256 の代わりに)。
msbuildの場所を見つけることができることに注意してください
$dotNetVersion = "4.0"
$regKey = "HKLM:\software\Microsoft\MSBuild\ToolsVersions\$dotNetVersion"
$regProperty = "MSBuildToolsPath"
$msbuildExe = join-path -path (Get-ItemProperty $regKey).$regProperty -childpath "msbuild.exe"