I am using Xamarin in Visual Studio.
I created an boilerplate android app (click me) and I tried the following:
Scenario 1:
Switch to release mode
right click on project > Export Android Package (.apk)
Side loaded generated .apk it onto my phone
App launches with no issue
Scenario 2
Switch to release mode
Tools > Android > Publish Android App
Signed APK after creating private key store
Side load generated .apk (in release folder) onto phone
App closes immediately after launching (no error message, nothing)
What could be the issue here?
Do I need to do anything else after signing the package?
In both scenarios, the output apk is the same size 5227kb
UPDATE:
I have tried the same thing running on the android emulator. Same results. The app runs fine in debug mode on the emulator. Once I've switched it to Release, I get "Unfortunately, App1 has stopped"
Here's the error log http://pastebin.com/4j1Vwtgf
UPDATE 2:
Here's the logs when I'm deploying under release mode:
1>Starting deploy 5" KitKat (4.4) XXHDPI Phone ...
1>Deploying 5" KitKat (4.4) XXHDPI Phone ...
1>Build started.
1>C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;__XAMARIN_ANDROID_v1_0__;__MOBILE__;__ANDROID__;__ANDROID_1__;__ANDROID_2__;__ANDROID_3__;__ANDROID_4__;__ANDROID_5__;__ANDROID_6__;__ANDROID_7__;__ANDROID_8__;__ANDROID_9__;__ANDROID_10__;__ANDROID_11__;__ANDROID_12__;__ANDROID_13__;__ANDROID_14__;__ANDROID_15__;__ANDROID_16__;__ANDROID_17__;__ANDROID_18__;__ANDROID_19__;__ANDROID_20__;__ANDROID_21__;__ANDROID_22__;__ANDROID_23__ /errorendlocation /preferreduilang:en-US /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\App1.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /target:library /utf8output MainActivity.cs Resources\Resource.Designer.cs Properties\AssemblyInfo.cs "C:\Users\a\AppData\Local\Temp\MonoAndroid,Version=v6.0.AssemblyAttributes.cs" obj\Release\\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs obj\Release\\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs obj\Release\\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
1>App1 -> C:\Users\a\Documents\Visual Studio 2015\Projects\App1\App1\bin\Release\App1.dll
1> Processing: obj\Release\res\layout\main.xml
1> Processing: obj\Release\res\values\strings.xml
1>C:\Program Files (x86)\Java\jdk1.7.0_55\\bin\keytool.exe -list -alias androiddebugkey -storepass android -keypass android -keystore "C:\Users\al\AppData\Local\Xamarin\Mono for Android\debug.keystore"
1>C:\Program Files (x86)\Java\jdk1.7.0_55\\bin\jarsigner.exe -keystore "C:\Users\a\AppData\Local\Xamarin\Mono for Android\debug.keystore" -storepass android -keypass android -digestalg SHA1 -sigalg md5withRSA -signedjar bin\Release\\App1.App1-Signed-Unaligned.apk "C:\Users\a\Documents\Visual Studio 2015\Projects\App1\App1\obj\Release\android\bin\App1.App1.apk" androiddebugkey
1>No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2046-02-20) or after any future revocation date.
1>C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.1\zipalign.exe 4 "C:\Users\a\Documents\Visual Studio 2015\Projects\App1\App1\bin\Release\App1.App1-Signed-Unaligned.apk" "bin\Release\\App1.App1-Signed.apk"
1>Build succeeded.
1>Deploy successfully on 5" KitKat (4.4) XXHDPI Phone
And here are the build logs for debug mode
2>Starting deploy 5" KitKat (4.4) XXHDPI Phone ...
2>Deploying 5" KitKat (4.4) XXHDPI Phone ...
2>Build started.
2>C:\Program Files (x86)\Java\jdk1.7.0_55\\bin\keytool.exe -list -alias androiddebugkey -storepass android -keypass android -keystore "C:\Users\a\AppData\Local\Xamarin\Mono for Android\debug.keystore"
2>C:\Program Files (x86)\Java\jdk1.7.0_55\\bin\jarsigner.exe -keystore "C:\Users\a\AppData\Local\Xamarin\Mono for Android\debug.keystore" -storepass android -keypass android -digestalg SHA1 -sigalg md5withRSA -signedjar bin\Debug\\App1.App1-Signed-Unaligned.apk "C:\Users\a\Documents\Visual Studio 2015\Projects\App1\App1\obj\Debug\android\bin\App1.App1.apk" androiddebugkey
2>No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2046-02-20) or after any future revocation date.
2>C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.1\zipalign.exe 4 "C:\Users\a\Documents\Visual Studio 2015\Projects\App1\App1\bin\Debug\App1.App1-Signed-Unaligned.apk" "bin\Debug\\App1.App1-Signed.apk"
2>Build succeeded.
2>Deploy successfully on 5" KitKat (4.4) XXHDPI Phone
I had the same error running release builds in the emulator (VS Android emulator). Turns out, we had disabled x86 as supported architecture.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With