7

I created a project click the button, it can run successfully on emulator. I try to install it on android mobile (Moto G), for that I search the (.apk file) in my project and it will locate it on bin/debug/filname.apk. In this bin folder, I have 2 apk file filename.apk and filename.signed.apk. I copied both apk file to my mobile and try to install filename.apk, but it failed to install and then I try to install filename.signed.apk it installed successfully. But when I try to open it on mobile it is force closing automatically.

I tried searching on google but didn't get any solution.

wonea
  • 4,783
  • 17
  • 86
  • 139
user2865434
  • 111
  • 2
  • 2
  • 10
  • @Abhinav Singh Maurya, Thanks for your correction. Please help me to solve this problem. – user2865434 Aug 21 '15 at 06:09
  • sorry to say I have not used visual studio to create application. So in your case I am unable to help it. May be other user can who have used visual studio. meanwhile I will also search and try to help you :) – Abhinav Singh Maurya Aug 21 '15 at 06:14
  • Thank you. Help would be very greatly appreciated. – user2865434 Aug 21 '15 at 11:06
  • Could you please let us know what are the crash logs of force closing. Alternatively you can add code to replace default force close and also mail intent to send mail of crash logs. check this links http://stackoverflow.com/questions/601503/how-do-i-obtain-crash-data-from-my-android-application && http://stackoverflow.com/questions/20399371/getting-the-crash-log-and-send-it-as-email . We can check crash logs what kind of exception is thrown – Abhinav Singh Maurya Aug 21 '15 at 11:22
  • I am .Net developer and sorry to say I haven't knowledge of android application development. Actually I am using visual studio 2015 community version. In VS 2015 we can create android application, IOS application and windows phone application using C# language. So I am trying to make one simple android application. – user2865434 Aug 22 '15 at 04:34

2 Answers2

4

Right Click on the application name in Solution Explorer

Go To "Properties" > "Android Options"

uncheck "use shared runtime".

Save and that's it!!!

These step may have to be repeated, in case xamarin is updated again. The "Export Android Package (.apk)" on context menu will now be enabled and you can go ahead with creation of apk. Happy programming!!!

1

Are you preparing your App to release to Google Play? Check out this link

Else

Open Project properties > Android Options

Set your configuration to "Release"

Under "Packaging" tab, untick:

  • User Shared Runtime
  • Generate one package (.apk) per selected ABI

*Under "Advanced" tab, untick:

  • x86
  • x86_64

*Make sure all arm are checked.

If you are using Visual Studio 2017 (15.0.0+26228.9), you can simply change the build to AppStore. Then deploy to your target device.

You can find 2 APKs generated by Visual Studio 2017:

/project-folder/bin/Release/my-app.apk
/project-folder/bin/Release/my-app-Signed.apk


Signed APKs are debug APK used by visual studio.

ikibiki
  • 136
  • 2
  • 10