title: Xamarin Android app closes immediately after launching
body: <p>I am using Xamarin in Visual Studio.</p>
  
  <p>I created an boilerplate android app (click me) and I tried the following:</p>
  
  <p>Scenario 1:</p>
  
  <ol>
  <li><p>Switch to release mode</p></li>
  <li><p>right click on project > Export Android Package (.apk)</p></li>
  <li><p>Side loaded generated .apk it onto my phone</p></li>
  <li><p>App launches with no issue</p></li>
  </ol>
  
  <p>Scenario  2</p>
  
  <ol>
  <li><p>Switch to release mode</p></li>
  <li><p>Tools > Android > Publish Android App</p></li>
  <li><p>Signed APK after creating private key store</p></li>
  <li><p>Side load generated .apk (in release folder) onto phone</p></li>
  <li><p>App closes immediately after launching (no error message, nothing)</p></li>
  </ol>
  
  <p>What could be the issue here?</p>
  
  <p>Do I need to do anything else after signing the package?</p>
  
  <p>In both scenarios, the output apk is the same size 5227kb</p>
  
  <p>UPDATE:</p>
  
  <p>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"</p>
  
  <p>Here's the error log <a href="http://pastebin.com/4j1Vwtgf" rel="noreferrer">http://pastebin.com/4j1Vwtgf</a> </p>
  
  <p>UPDATE 2:</p>
  
  <p>Here's the logs when I'm deploying under release mode:</p>
  
  <pre><code>1&gt;Starting deploy 5" KitKat (4.4) XXHDPI Phone ...
  1&gt;Deploying 5" KitKat (4.4) XXHDPI Phone ...
  1&gt;Build started.
  1&gt;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&gt;App1 -&gt; C:\Users\a\Documents\Visual Studio 2015\Projects\App1\App1\bin\Release\App1.dll
  1&gt;  Processing: obj\Release\res\layout\main.xml
  1&gt;  Processing: obj\Release\res\values\strings.xml
  1&gt;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&gt;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&gt;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&gt;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&gt;Build succeeded.
  1&gt;Deploy successfully on 5" KitKat (4.4) XXHDPI Phone
  </code></pre>
  
  <p>And here are the build logs for debug mode</p>
  
  <pre><code>2&gt;Starting deploy 5" KitKat (4.4) XXHDPI Phone ...
  2&gt;Deploying 5" KitKat (4.4) XXHDPI Phone ...
  2&gt;Build started.
  2&gt;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&gt;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&gt;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&gt;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&gt;Build succeeded.
  2&gt;Deploy successfully on 5" KitKat (4.4) XXHDPI Phone
  </code></pre>