Forum Xamarin.Forms

Fixing "App not installed" problem (APK distribution)

DgrDgr Member ✭✭
edited July 2020 in Xamarin.Forms

Hello, I used Microsoft's "Preparing an Application for Release" and "Signing the Android Application Package" tutorials in order to run an APK of an app I built on my Samsung Galaxy S8 phone.
When I try to run the APK, I am getting a message "Do you want to install an update to this existing application?...", and when tap "install", it shows an "installing" screen, and after couple of seconds I am getting a message "App not installed".
I have done these steps couple of times, each time I got the same result.
I disabled "Play Protect" and "App Permissions", tried creating different key, removed all previous distributions (same project, none of them worked).
I am using Windows 10.

I would like to know what could probably fix this issue?

Best Answer

  • DgrDgr Member ✭✭
    Accepted Answer

    OK, so after trying to understand where my error was (a lot of ctrl+f's), I had:
    "failure copying native libraries error code=-113".
    This means I had to my app.Android in Solution Explorer -> Properties -> Android Options -> Advanced -> unchecked all except the last one, then unchecked it, and it checked right back what was needed for it to work.
    Then it didn't work AGAIN.
    So I looked up again in logcat (after trying to install again, so that I will see the new error), and I found this:
    "signatures do not match previously installed version; ignoring!".
    I went to Settings -> Apps -> searched my app by its name -> Uninstalled.
    Then I tried installing again, and it works!
    Thank you for your patience and guidance.

    BTW, for the sake of other people - How to use logcat? (generally! you may experience some issues, google it and you'll do fine):
    1. Connect your phone to your computer.
    2. go into: c:\Users\YOURUSERNAME\AppData\Local\Android\Sdk\platform-tools
    3. type "adb logcat".

Answers

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    after couple of seconds I am getting a message "App not installed".

    When the app with same package name already exists, this error will occur. The previous version of the application may be not uninstalled cleanly, try to clear the cache. Or you could change the package name, the error will be gone.

    Here is the process of creating the apk, you could refer to it.

    1. First change your build type to Release from debug.
    2. Clean
    3. Rebuild
    4. Right click your android project and click on archive
    5. After successful archive click on Distribute and click on Ad-hoc
    6. Create keystore file
    7. After finishing click on Open Distribution.
    8. The apk file is ready.
  • DgrDgr Member ✭✭

    @YelinZh said:

    after couple of seconds I am getting a message "App not installed".

    When the app with same package name already exists, this error will occur. The previous version of the application may be not uninstalled cleanly, try to clear the cache. Or you could change the package name, the error will be gone.

    Here is the process of creating the apk, you could refer to it.

    1. First change your build type to Release from debug.
    2. Clean
    3. Rebuild
    4. Right click your android project and click on archive
    5. After successful archive click on Distribute and click on Ad-hoc
    6. Create keystore file
    7. After finishing click on Open Distribution.
    8. The apk file is ready.

    Thank you for your reply.
    I tried clearing cache, and changing package name. Both didn't help fixing the problem.
    I followed the process of creating the apk as you described, it is identical to what I have previously done.
    Unfortunately, the error is still there.

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    Make sure to set signing identify for the apk? To publish the APK, it must first be signed with a signing key (also referred to as a certificate).

  • DgrDgr Member ✭✭

    @YelinZh said:
    Make sure to set signing identify for the apk? To publish the APK, it must first be signed with a signing key (also referred to as a certificate).

    I created signing in the first place, didn't help.
    I created a new "Helloworld" project and deployed it - it works good.
    I used the same key for both of them, changed solution name - it does not work.

    Any ideas what to do? Maybe copy project to new project or something?

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    Could the apk be installed in other devices? Try to use logcat to get the details about the log.

    Check the link:
    https://forums.xamarin.com/discussion/comment/262271/#Comment_262271

  • DgrDgr Member ✭✭

    @YelinZh said:
    Could the apk be installed in other devices? Try to use logcat to get the details about the log.

    Check the link:
    https://forums.xamarin.com/discussion/comment/262271/#Comment_262271

    Ok so I got a log of what happened on that time period (while trying to install), and there are too many lines of log.
    What am I supposed to fined exactly? I have not idea what to do.

  • DgrDgr Member ✭✭
    Accepted Answer

    OK, so after trying to understand where my error was (a lot of ctrl+f's), I had:
    "failure copying native libraries error code=-113".
    This means I had to my app.Android in Solution Explorer -> Properties -> Android Options -> Advanced -> unchecked all except the last one, then unchecked it, and it checked right back what was needed for it to work.
    Then it didn't work AGAIN.
    So I looked up again in logcat (after trying to install again, so that I will see the new error), and I found this:
    "signatures do not match previously installed version; ignoring!".
    I went to Settings -> Apps -> searched my app by its name -> Uninstalled.
    Then I tried installing again, and it works!
    Thank you for your patience and guidance.

    BTW, for the sake of other people - How to use logcat? (generally! you may experience some issues, google it and you'll do fine):
    1. Connect your phone to your computer.
    2. go into: c:\Users\YOURUSERNAME\AppData\Local\Android\Sdk\platform-tools
    3. type "adb logcat".

Sign In or Register to comment.