'App not Installed' Error on Android

2018-12-31 12:04发布

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.

30条回答
姐姐魅力值爆表
2楼-- · 2018-12-31 12:38

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

查看更多
千与千寻千般痛.
3楼-- · 2018-12-31 12:39

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" />
查看更多
心情的温度
4楼-- · 2018-12-31 12:40

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 image description here

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!

查看更多
情到深处是孤独
5楼-- · 2018-12-31 12:40

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.

查看更多
一个人的天荒地老
6楼-- · 2018-12-31 12:40

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

查看更多
旧时光的记忆
7楼-- · 2018-12-31 12:40

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.

查看更多
登录 后发表回答