94

I have updated Android studio to 3.5, ever since I am running into an APK installation problem. This is the only log it shows:

Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION
Installation failed due to: 'null'
Retry

This happens when trying to install APK on a real device. If I uninstall the app from the device and then rerun the build, it installs only one time and then it keeps throwing this error on the next installation. It runs fine on an emulator but I can not use an emulator for everything.

What I have tried:

  • Deleted Android Studio configuration file.
  • Deleted Gradle files from the project.
  • Invalidated and reset caches.
  • Cleaned/rebuilt the project.
  • Looked for similar problems Stackoverflow(nothing matches my problem)
  • Clean installed(Removed all files including SDKs) Android Studio 3.5

Update

I installed Linux Mint on my machine and tested the AS 3.5 there, for some reason everything is working fine even for Android 7 and below devices.

Previous OS: Windows 10 1903

Current OS: Linux Mint 19.2

I reckon this problem may be originating from Windows machines.

17
  • I have similar problem - but for me it's INSTALL_PARSE_FAILED_NOT_APK while running Espresso tests
    – adek111
    Aug 21, 2019 at 19:46
  • I'm also getting INSTALL_PARSE_FAILED_NOT_APK
    – Job Evers
    Aug 22, 2019 at 0:58
  • I'm also getting the same issue.
    – Santhosh
    Aug 22, 2019 at 7:11
  • 16
    wow Google, how can you make this a STABLE release?!
    – 0101100101
    Aug 23, 2019 at 3:16
  • Did you check if the Instant Run is enabled in your Android Studio? Aug 23, 2019 at 6:11

37 Answers 37

1
2
0

I got this problem a few minutes ago when I tried running my app on real device and stopped gradle build before it finished. What I just did was to uninstall the app on device and rerun the app on both AVD and real device (simultaneously) and it worked. Hope this works for you too

0

Main Solution

  1. File -> Settings -> Build, Execution, Deployment -> Debugger > Disable Use libusb backend

  2. Gradle (Flap to the right of the IDE) -> android -> app -> Tasks -> install -> uninstallAll or you can also do it by console in the following way:

    $ ./gradlew uninstallAll



Other Tips:

  • Delete and create the app again in Run/Debug Configuration

    • Installation Options -> Check Install for all users
  • Run/Debug Configuration -> Launch Options > Launch: Specified Activity > Choose an Activity

  • Install app using another physical device, version of the IDE or PC

  • Reinstall IDE and delete .android

  • Retry with the main solution


If you want to install and open the app you can use adb with the following commands:

$ adb install -r -t absolute-path.apk

$ adb shell am start -n "com.package.flavor.env/.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

GL

Source

0

For me the issue started when I created a new blank activity and Android studio created a Wearable activity for some reason. Once I removed all mentions to wearable activity from the manifest and I deleted the class everything went back to normal.

0

I had this same symptom, but the cause and solution is completely different from what others have been experiencing, so I'm posting this solution just to add to the knowledge base of known things that can cause this error.

I'm running Android studio Android Studio Giraffe | 2022.3.1 Patch 2 on Windows 11.

I don't get any Build errors when I build the project, and the error consistently happens when I try to debug the app. None of the proposed solutions such as cleaning the project, invalidate caches, adding -r -t adb option, etc. resolved the issue. The general belief and proposed solutions seems to be centered around the ideas that somehow your project or android studio itself has been corrupted. In my case, that's not the situation!

What's different from this particular project, compared to many other projects I've made, is that the project contains an Android Service. In the manifest for the service configuration I had added the attribute "android:process = "networkDiscovery". When I change it to "android:process = ":networkDiscovery", I would no longer get Installation Failed error.

So in my case, the cause of the problem was related to a manifest configuration issue. In my particular case I observed this problem with trying to configure the Android Service process. I would suspect that there may be other related manifest configuration issues that may also cause this problem.

-1

try to chang android:appComponentFactory="" to android:appComponentFactory="new","new" can be any words

-2

Finally, I got the solution in the code edit run configuration changing in Installation option DEPLOY--> from select 4th option -->(Nothing) option --> Apply And the app works properly in android studio 3.5. In mobile and emulator also. This work properly in android version 9 also This is a permanent solution.

-2

gradle.properties -> android.enableAapt2=false

1
  • DO NOT USE THIS! Aapt has been deprecated in favor of aapt2, and will eventually be removed. This workaround will stop working, and cause other problems when aapt is removed
    – Zoe is on strike
    Jul 7, 2020 at 11:54
1
2

Not the answer you're looking for? Browse other questions tagged or ask your own question.