Session 'app': Error Installing APK

AndroidAndroid StudioInstallationApkAdb

Android Problem Overview


Trying to install app on real device following instructions:- http://developer.android.com/tools/device.html. At end Android Studio giving error:

Session 'app': Error Installing APK 

I guess the problem probably can be in my android device(it is chinese Doogee X5). It does not have a given USB Vendor ID in developer docs so I decided to follow instructions with random vendor ID from HTC.

I'm sure there is a way to run application on any android device, but yet I didn't find an answer on how to do that.

I'm running through Linux Ubuntu 14.04 LTS

Android Solutions


Solution 1 - Android

Edit:

In newer Android Studio versions you can re-sync the project using this button:

enter image description here

For older versions:

Open Gradle window (on the right side in Android Studio) and click on the refresh button.

However it is not a 100% sure fix.

Solutions for other cases:

Open terminal window and type "adb kill-server", then type "adb start-server". Usually after a few hours of inactivity, adb used to disconnect the device. (If you don't have the sdk/platform-tools in the PATH environment variable, then you should open a terminal in that folder)

One tip if these solutions don't help you: If you open the Event Log window in the right bottom corner of Android Studio, you can see a detailed error message.

Other edge case If you see this error: INSTALL_FAILED_INVALID_APK:... signatures are inconsistent. Then unfortunately a gradle refresh isn't enough, you have to go to Build -> Clean Project and then Run again.

Issue with Android emulator If you want to deploy the APK to an Android Emulator and you see the "Error installing APK" message, your emulator may be frozen and need restart.

Solution 2 - Android

Turning off the Instant run removed my error for Androdi Studio 2017.03.03 v2.3

enter image description here

Solution 3 - Android

You have to enable Developer options and enable USB Debugging:

  1. Go to the settings menu, and scroll down to "About phone." Tap it.
  2. Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.)
  3. Tap it seven (7) times. After the third tap, you'll see a playful dialog that says you're four taps away from being a developer. (If only it were that simple, eh?) Keep on tapping, and poof, you've got the developer settings back.

http://www.androidcentral.com/how-enable-developer-settings-android-42

Inside Developer Options, enable USB Debugging

enter image description here

Solution 4 - Android

Try using a different version of Gradle(stable version). To summarize:

  • Check your gradle file for debuggable false/true
  • Invalidate caches & restart
  • Check your install location
  • Restart adb

Solution 5 - Android

I fix this by delete the build folder then run project again

enter image description here

Solution 6 - Android

Make sure that your device is not out of Memory!

Solution 7 - Android

I changed my USB port and that fixed it for me.

Solution 8 - Android

Make sure that project name doesn't contain special character.

Solution 9 - Android

Another possibility may be the USB driver on your PC. In my case, switching from my 3.0 USB port to my 2.0 port fixed the problem.

Solution 10 - Android

Ensure you android device has enough memory to install the app. Sometimes it so happens working with multimedia app where the device storage keeps on increasing and you keep wondering about the error.

Therefore, free up some memory and try installing again!

Solution 11 - Android

A bit late to the party, but be sure that you are trying to build a proper build variant. It sometimes happens to me that when I update AS, the build variants are totally messed up, so instead of building the "debug" variant I am actually building the "release" variant, which outputs apk to a different location (not to app/build directory, but to app directly) and I get the following error:

The APK file /path/to/file/app.apk does not exist on disk.
Error while Installing APK

To fix this just open the menu in left bottom corner, click on "Build Variants" and select the debug variant (it might have a different name, depending on how many modules/flavors or custom gradle build types you have).

Solution 12 - Android

Try to remove the .idea folder and .gradle folder, then click Sync Project with Gradle Files, when the process finished, try to run app again.

Hope it works.

Solution 13 - Android

just press Build button from menu bar and then press build app wait for it finished then press build APK and then run your emulator, it will work

Solution 14 - Android

Usage of easily changing variable value will often happen in build.gradle(like the Date)

enter image description here

Solution 15 - Android

In my case with Android 8.0(Oreo), no one of this solutions worked! If you have more than 1 user, then you should go to Settings->Applications->All Applications->Find the application and uninstall for all users! After this steps, it worked!

Solution 16 - Android

Just rebuild and clean project, then run project.

Solution 17 - Android

This happens because the gradle is not synced with the app. Go to : Tools -> Android -> Sync Project with Gradle files. Re-run and you should be good to go.

Solution 18 - Android

Nothing above helped me. The fingerprint dialog did not appear. I checked another android device and the dialog appeared and debug was possible. So the problem was on device side not on computer side I made reset "to factory settings" on device and this helped me.

Solution 19 - Android

I fixed my issue, simply by using :

Build->Clean Project

then

Build->Rebuild Project

Solution 20 - Android

I had this same issue and none of the other solutions worked for me.

Although no errors were shown nor expanded upon in my IDE GUI, I opened up a second Android Studio window window with a different project and noticed in the bottom that the "Event Log" showed an error in a different window, but not in the project I had opened. The issue stated was:

Error: INSTALL_FAILED_CONFLICTING_PROVIDER

Which lead me here - https://stackoverflow.com/q/16267785/2480714 :

I had this FileProvider labeled in the manifest:

<provider
    android:name="androidx.core.content.FileProvider"
    android:authorities="myapp.sameonehere.android.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/file_paths" />
</provider>

Which I had copied from another project and forgotten to rename the 'authorities' String in. After changing it to something unique, it ran without issue.

Make sure you don't have any conflicting authority Strings like in my example.

Also, if no errors are showing up, try opening a second project and see if the "Event Log" shows errors in that location instead.

Solution 21 - Android

Uninstall the app, and re-install and it should work!

Solution 22 - Android

Go to avd manager and click on Wipe Data of the device you want to run. Worked for me. The size of device on disk will reduce after wiping the data. I hope it helps someone.

Solution 23 - Android

You have to enable Developer options and enable USB Debugging:

1:Go to the settings menu, and scroll down to "About phone." Tap it. 2:Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.) Tap it seven (7) times. After the third tap, you'll see a playful dialog that says you're four taps away from being a developer. Keep on tapping, and poof, you've got the developer settings back.

Solution 24 - Android

My issue was solved by Clean --> ReBuild --> Run and in my case it was because i accidentally deleted the project folder and when i clicked ctrl+z to restore something wrong happened.

Solution 25 - Android

My problem was that I didn't accept the connection from the computer after turning on remote debugging. Once I accept the mac address, it went away. Silly mistake, but I didn't see the dialog box the first time. Worth a quick check if the others don't resolve the issue. But likely only a problem the first time you set up a phone.

Solution 26 - Android

What worked for me is deleting the app from the emulator (which was an app built from an older commit) and re-running from Android Studio.

Solution 27 - Android

It was written above: in my case it was just out of memory on device storage. Add more empty space - and error will disappear

Solution 28 - Android

I tried invalidating cache, deleting build folder and gradle sync. Also, I couldn't uninstall because the app is not visible on device. So I tried uninstalling through ADB and it worked.

adb uninstall <package_name>

Solution 29 - Android

If you are using android emulator, try changing a device.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionStanislav BarabanovView Question on Stackoverflow
Solution 1 - AndroidAndras KloczlView Answer on Stackoverflow
Solution 2 - AndroidZeroView Answer on Stackoverflow
Solution 3 - AndroidJorgesysView Answer on Stackoverflow
Solution 4 - AndroidAnatolyView Answer on Stackoverflow
Solution 5 - AndroidLinhView Answer on Stackoverflow
Solution 6 - AndroidTripathee GauravView Answer on Stackoverflow
Solution 7 - AndroidZach WymerView Answer on Stackoverflow
Solution 8 - AndroidHiren PatelView Answer on Stackoverflow
Solution 9 - AndroidPaul WeberView Answer on Stackoverflow
Solution 10 - AndroidVikas GarhwalView Answer on Stackoverflow
Solution 11 - AndroidvanomartView Answer on Stackoverflow
Solution 12 - AndroidKapil RajputView Answer on Stackoverflow
Solution 13 - AndroidMohamed SedaView Answer on Stackoverflow
Solution 14 - AndroidchanyView Answer on Stackoverflow
Solution 15 - AndroidShahen KosyanView Answer on Stackoverflow
Solution 16 - AndroidHoussin BoullaView Answer on Stackoverflow
Solution 17 - AndroidAniruddh GogateView Answer on Stackoverflow
Solution 18 - Android0x000fView Answer on Stackoverflow
Solution 19 - AndroidRinglayer NetworkView Answer on Stackoverflow
Solution 20 - AndroidPGMacDesignView Answer on Stackoverflow
Solution 21 - AndroidKaran KhuranaView Answer on Stackoverflow
Solution 22 - AndroidFidan GillView Answer on Stackoverflow
Solution 23 - AndroidUsman AliView Answer on Stackoverflow
Solution 24 - AndroidZeyadView Answer on Stackoverflow
Solution 25 - Androidbrocky34View Answer on Stackoverflow
Solution 26 - Androidmt0sView Answer on Stackoverflow
Solution 27 - AndroidEugene VoronoyView Answer on Stackoverflow
Solution 28 - AndroidmihirjoshiView Answer on Stackoverflow
Solution 29 - AndroidloickView Answer on Stackoverflow