Android Studio: Installation failed since APK was not signed

前端 未结 7 996
谎友^
谎友^ 2021-01-01 19:41

I am attempting to run my app in an emulator and have been receiving the following error:

Installation failed since the APK was either not signed, or

相关标签:
7条回答
  • 2021-01-01 19:43

    I had this same problem occur last night. Running in debug, in my case the app had previously been installed from weeks ago, and I had deleted it, but I was still getting the error and couldn't install it again. I was able to resolve it by going into the AVD manager and wiping user data from there. After that installation and debugging went fine.

    0 讨论(0)
  • 2021-01-01 19:45

    I solved it more or less following the answer of Alex K above, but did not know where to look for 'settings' (total beginner!).

    So go to the AVD manager (icon of mobile in toolbar) and click on the arrow on the far right, a small menu appears and here you select 'Wipe Data'.

    You do need to first close the emulator.

    0 讨论(0)
  • 2021-01-01 19:49

    There may be already install current app with certificate

    uninstall it and try again

    0 讨论(0)
  • 2021-01-01 19:49

    What I tried:

    • Clean Project and Build again
    • Invalidate cache (File -> Invalidate Caches/Restart ...)
    • Reinstalled Debug certificate in case it expired
    • Cleared Gradle cache
    • Add signing process to Gradle
    • Went to settings -> apps in the Emulator and deleted previous versions (as explained in this thread)
    • Wiping Emulator data through AVD interface
    • Upgraded gradle version

    None of those solved the issue. In the end I executed the compilation/signing steps manually until I found the culprid: One of the file in my asset folder was 'Icon?' generated by MacOSX

    In order to detect it I followed the instructions here to Build an unsigned APK and sign it manually: https://developer.android.com/studio/publish/app-signing#sign-manually

    When I ran step 3 (apksigner) I got an exception with message cannot sign apk because of file ..\folder\folder\Icon?

    I understand that what was happening is that Android Studio did not capture the exception and tried to deploy the unsigned application onto the emulator.

    Once I removed the file and tried again I no longer had the issue. (quite a pain to find the root cause...)

    So, step 1:

    • Run the standard check (clear cache..)
    • IF you have a MacOSX, check if one or multiple of your file is 'Icon?'
    • Step 2 - run the steps manually
    0 讨论(0)
  • 2021-01-01 19:57

    This problem can be resolved by below two ways

    1. Change Built Variant to debug cnange_built_variant
    2. Define your application`s signingConfigs signingConfigs

    First solution works when you built your application in debug mode. But, once you are ready to publish your application on Google Play store you need to go by second way.

    Read for more -> Sign Your App

    Hope this will help one and all!

    0 讨论(0)
  • 2021-01-01 20:03

    If you still get this error in debug mode, follow these steps:

    1. Clean your project
    2. Run it again

    This works for me on Android 2.2 Beta.

    0 讨论(0)
提交回复
热议问题