-->

'App not Installed' Error on Android

2018-12-31 11:38发布

问题:

I have a program working in the Android Emulator. Every now and again I have been creating a signed .apk and exporting it to my HTC Desire to test. It has all been fine.

On my latest exported .apk I get the error message \'App not installed\' when I try to install the .apk. It runs fine on the emulators.

As I have mainly been testing on the emulators and only every now and again exporting to a real phone I am not sure when this happened. What is the likely cause of it not installing on a physical phone but running fine in the emulators?

I have tried rebooting the phone & removing the existing .apk, does not fix the fault.

回答1:

Primarily for older phones

I only encountered the App not installed error when trying to install an apk on my phone which runs on 4.4.2 aka KitKat, but my friend did not encounter this error on his phone which runs on 6+. I tried the other solutions such as removing the old/debug version of the app because the apk was a release version, clearing the debug app\'s data, and even clearing all of my cached data. Then, finally I realized all I had to do was select both signature versions when building my signed apk.

\"enter

Before I only had V2 (Full APK Signature) selected, but after selecting V1 Jar Signature as well, I was able to successfully install my signed APK on my 4.4.2 device. Hope this helps others!



回答2:

I had a similar issue and it was because I was trying to install an apk on a phone with a previous version of the same apk, and both apks hadn\'t been signed with the same certificate. I mean when I used the same certificate I was able to overwrite the previous installation, but when I changed the certificate between versions, the installation was not possible. Are you using the same certificate?



回答3:

Clearly there are many causes of this problem. For me the situation was this: I had deployed to my nexus 7 (actual device) from within the Android Studio (v1.3.2). All worked fine. I then created a signed apk and uploaded to my Google Drive. After disconnecting my nexus from the usb, I went to the settings/apps and uninstalled my app (App1). I then opened google drive and clicked on my App1.apk and chose to install it (need to ensure you have allowed installation of apks in settings). Then I got the dreaded message \"App not Installed\"

Solution for me: go back into settings/apps and scroll though all apps and at the bottom was a pale version of my App1 (note the original App1 was at the top in Alphabetical order which was deleted as above). When clicking on the pale version it said \"Not installed for this user\". (I had set up my nexus to have more than one user). But in the top right corner there is a three dot button. I pressed this and it said \"Uninstall for all users\". Which I did and it fixed the problem. I was now able to click on App1.apk and it installed fine without the error.



回答4:

I faced with the same problem. The problem was the main activity in my AndroidManifest.xml file was written twice. I deleted the duplicate.



回答5:

For me, On Android 9 (API 28), disabling Google Play Protect from play store app worked the trick, and i was able to get rid of the App not Installed error.

To disable Google Play Protect. Open \"Play Store\" application => tap on Menu button => select \"Play Protect\" option => Disable the options \"Scan device for security threats\".



回答6:

This can happen if you have your MainActivity declared twice in your AndroidManifest.xml.

Another possible reason: you changed the launch activity. Hint: never do it with already published applications! Reasons discussed in Android Developers blog.



回答7:

I faced the issue when I update my android from 2.3.2 to 3.0.1 . If this is the case the IDE will automatically considers the following points.

1.You cannot install an app with android:testOnly=\"true\" by conventional means, such as from an Android file manager or from a download off of a Web site

2.Android Studio sets android:testOnly=\"true\" on APKs that are run from

if you run your app directly connecting the device to your system, apk will install and run no problem.

if you sent this apk by copy from build out put and debug folder it will never install in the device.

Solution :go Build ---> Build APK(s) ---> copy the apk file share to your team

then your problem will solve.



回答8:

I had the same problem. I did not realise that an app must be signed even for testing.

After self signing it, it installed fine.



回答9:

I know this is an old post, but for new users may be useful. I had the same problem: my application worked fine while debbuging. When I signed the APK I got the same message: \"Application not installed\".

I fixed that uninstalled my JDK (I was using jdk-6u14-windows-x64) and installed a new one (jdk-6u29-windows-x64). After export and sign the APK again, everything was ok!

Resuming, my problem was in JAVA version. Thank\'s Oracle!!



回答10:

I had the same problem and here is how solved it : Go to the Manifest file and make sure you have the \"Debuggable\" and the \"Test Only\" attributes set to false. It worked for me :)



回答11:

My problem was that I have multiple user accounts on the device. I deleted the app on 1 account, but it still was installed on the other account. Thus the namespace collided and did not install. Uninstalling the app from all user fixed it for me.



回答12:

If application\'s not installing, delete the file .android_secure/smdl2tmpl.asec from the SD card.

If the folder .android_secure is empty in the file manager, delete it from the PC.



回答13:

I have also solved this issue,

The problem was that i declared my main activity twice, On as the first activity to load and i specified also an intent-filter for it And once again below it i declared it again .

Just make sure you don\'t declare your activities twice .



回答14:

For those who are using Android Studio 3.

Suryanarayana Reddy\'s Answer is correct thought it doesn\'t state steps to solve it, hence.

in your AndroidManifest.xml under the application tag add testOnly=\"false\" and android:debuggable=\"true\" like so:

<application
    android:allowBackup=\"true\"
    android:icon=\"@mipmap/ic_launcher\"
    android:label=\"@string/app_name\"
    android:roundIcon=\"@mipmap/ic_launcher_round\"
    android:supportsRtl=\"true\"
    android:theme=\"@style/AppTheme\"
    android:testOnly=\"false\"
    android:debuggable=\"true\"
    >

Edit
then in AndroidStudio\'s menubar Build > Build APK(s)



回答15:

In the end I found out that no apps were being installed successfully, not just mine. I set the Install App default from SD card to Automatic. That fixed it.



回答16:

If you have a previous version for that application try to erase it first, now my problem was solved by that method.



回答17:

I had the same issue, i.e. App showed up as being installed, but would not launched when the icon was tapped. After some head-banging, I found that I had stupidly placed \' android:exported=\"false\" \' for my main launcher activity within the AndroidManifest file.... Once I removed it, the App launched fine..



回答18:

My problem was similar to that of @Lunatikzx. Because of wrong permission tag which was written as attribute to application:

<application
    android:permission=\"android.permission.WRITE_EXTERNAL_STORAGE\"
    android:label=\"@string/app_name\"
    android:icon=\"@drawable/ic_launcher\"
    android:testOnly=\"false\"
    android:debuggable=\"true\">

What fixed it for me was changing permission tag to separate tag like this:

<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />


回答19:

create keystore file through command line

keytool -genkey -alias key_file_name.keystore -keyalg RSA -validity 1000000000000000 -keystore key_file_name.keystore

export apk through Eclipse, right click on Android project Android Tools > Export Signed Application Package, then give keystore location & password.

this will crate signed apk at the same time apk will be zipaligned. And installable.

If you go through command line for all, some times you may face \"Application not installed\" error. (Application not installed error can happen not only, when using command line. It can be some other reasons as well)



回答20:

Check with the Android version.

If you are installing non-market apps, and incompatible version you will get this error.

Ex: Application targetted to 2.3.4 Your device is 2.2 Then you will get this error.



回答21:

The \"Application not installed\" error can also occur if the app has been installed to or moved to the SD card, and then the USB cable has been connected, causing the SD card to unmount.

Turning off USB storage or moving the app back to internal storage would fix the issue in this case.



回答22:

I also encountered this issue. Kindly try this solution. Make sure that the package name of your project is different from your previous project that was already installed in your mobile phone. I think they get conflict in their names. It works in me.



回答23:

You also may encounter this issue because your device manufacturer did not license the Google commercial apps, such as Play Store, YouTube, Google Maps, etc. Follow this answer to solve the problem.



回答24:

My problem was: I used the Debug Apk, that was generated while I did the Run command from Android Studio

Solution was: Instead of using this file, clean project and click Build > Build APK(s) from Android Studio. Then you can use the generated APK from the usual folder (app/build/outputs/apk/debug/)

The file that was generated like this installed without a problem.



回答25:

Apparently this can also be caused by renaming the APK prior to installing it. I wanted to reduce the amount of typing users had to do to get the app from our web site by shortening the file name. After that, they were unable to install it.

Once I reverted to the original file name used when creating and signing the package I was able to update the installed app.



回答26:

for me the cause was that i had multiple builds using different build variants on same phone:

\"enter

what happened was that some of these builds were built by me, another one was sent to me by another developer.. trying to install the developers while i had other builds (built by me) caused the above error.

so the fix was simple: delete all the builds on my phone (regardless of build variant).. then install the apk sent by my peer.. and it worked like a charm



回答27:

Open your logCat when trying to install the app. Set it to \"No Filters\". Search for \"InstallAppProgress\" package identifier. If the install fails you should see an \"Installation error code\". In my case it was

D/InstallAppProgress: Installation error code: -7

From here you can use this link to find information about your specific error code.



回答28:

In my case, it\'s because Android Studio 3.0 sets android:testOnly=\"true\" on APKs that build from the release Build Variant.

https://commonsware.com/blog/2017/10/31/android-studio-3p0-flag-test-only.html

So run ./gradlew assembleRelease solve my issue



回答29:

I had the same type of error this was cauysed by this line in my android manifest XML file.

android:permission=\"android.permission.INSTALL_LOCATION_PROVIDER\"

I removed the line and it solved my issue. Hope this helps



回答30:

This can also occur when making a home screen widget, and your widget XML file has an incorrect Activity specified in its android:configure property.