Session 'app' error while installing APK
Asked Answered
A

36

55

I am having difficulty importing a project written on Android Studio 1.1 into Android Studio 2.1.2. I keep getting this error whenever the gradle is building before testing the app on a tablet. Below is a screen shot of the error. Does anyone know what the problem could be?

I have tried adb kill-server followed by adb start-server as well as some other gradle versions compatible with the project. Other than this, I have not been able to find many more suggested solutions to the problem ("session 'app': error installing APK").

Additionally, I have tried uploading a basic Hello World project which successfully built the gradle.

Error message from Grable Build

Initial Error Message

Second set of Errors

Aman answered 19/7, 2016 at 6:8 Comment(5)
Did you try cleaning the project and then building it again?Mima
Yes, I did try to clean the project again.Aman
Be sure to check my answer at https://mcmap.net/q/104118/-session-39-app-39-error-installing-apkWhiggism
I had same problem, cleaning and rebuilding the project did work for me.Anglophile
I solved error like this by running "gradlew.bat clean" and then restarting android studioJeanett
K
102

I was facing similar kind of problem.There is image of error attached.Error is highlighted in red. Turning off the Instant run removed error for Android Studio 2.3 and 3.1.4.

Error, after running the app Turning off the Instant run

Kellykellyann answered 6/3, 2017 at 3:32 Comment(5)
Hi, It did solved my issue. But I have no idea why, it was working fine and then all of the sudden it wasn't. But disabling instant run did solved it. Do you know why this happened?Lubow
Windows 10 with Android Studio 2.3 : To open this window, File => Settings, in the left pane Build, Execution, Deployment => Instant RunGumbo
@SaravananSachi: What about the latest, 3.0 ? Don't see any Instant Run settings there.Revenue
this option not available for android 3.0.1 mac OS.How can I solve this issue?Twannatwattle
This is one of the reasons why I do not like Android Studio. It looks like it was a poorly planned software. How on earth does Google want developers to correlate Session 'app': Error Installing APK error with an issue caused by Instant Run??!!!Tensive
R
29

Best step to resolve this error is- Uncheck the instant run in File >Settings >Build,Execution,Deployment > Instant Run

Rashad answered 25/3, 2017 at 16:4 Comment(2)
This worked, but it's now Android Studio > Preferences > Build,Execution,Deployment > Instant RunHousen
After this i've restarted the android studio. Everything working fine. Thanks to prajapati chetanaHaro
F
21

Note: The top answers recommend to disable Instant Run. Try this before exploring my listed solutions to prevent wasting more time than needed.

Here are some possible solutions:

1) Make sure that your phone is properly connected to your PC with a USB cable: Before going over these fixes, make sure that you have at least connected your phone to your computer properly. If it's properly connected, your phone should be charging.

2) Make sure that your device's driver software is up-to-date: Simply go to your File Explorer and then right click Computer. Then, select Manage (requires administrator privileges). In your Computer Management window, find a tab on the left pane that says Device or Device Manager. Search for your device from there. Mine was under Portable Devices and the name started with SAMSUNG, so finding your device shouldn't be too hard. Right click the device, and then select Update Driver Software.... I chose the Search automatically for updated driver software option, since it's much easier.

3) Enable USB debugging under your Developer Options: For my Samsung Galaxy S9, I found mine under Settings > Developer Options. From there, enable USB Debugging. If you can't find your Developer Options, find your build number within the settings and tap it 7 times consecutively. I found mine under Settings > About Phone > Software information.

4) Make sure you've allowed USB debugging for your specific computer: Although you may have your USB Debugging option enabled, you still need to allow USB debugging for your specific computer. A popup should appear asking Allow USB debugging? and providing the computer's RSA key fingerprint. Before pressing OK, make sure your check Always allow from this computer, so that you don't have to go through this again in the future. If you think you've done this but yet your device is still marked as OFFLINE, select the Revoke USB debugging authorization option in 'Developer Options'. Then, re-allow your computer for USB Debugging. If the popup doesn't appear, reconnect your phone to the Computer (pull the cable out and put it back into your Phone).

5) Trying cleaning AND rebuilding your project: In Android Studio, open up the Build tab at the top left and try both the Clean and Rebuild options.

If none of the above works out: Reinstall Android Studio by Uninstalling the program and re-downloading the setup file here. Scan for any viruses that may be affecting your computer. Check for any sort of error while reinstalling Android Studio. If none of the methods presented in this answer work, fetch for support here.

Good luck.

Floaty answered 3/9, 2016 at 3:30 Comment(2)
Cleaning and rebuilding worked for me. Better than disabling instant run.Hooch
Also make sure your phone is set to connected for File Transfer, not just connected over USB for charging.Lallygag
F
10

Follow this steps to overcome the issue.

  1. Disconnect all devices connected to System/Close all emulators running on System.
  2. Turn Off Instant Run feature from settings.
  3. Perform a clean build.
  4. Turn ON Instant Run feature from settings.
  5. Perform a clean build.
  6. Connect your device/start your Emulator and ensure it is online.
  7. Run the Project by selecting the device/emulator.

NOTE:-

1) You should not have different instances of Android Debug Bridge(adb) running on system.

2) If using Genymotion then make sure that you use the custom sdk path mentioned in the Genymotion settings the which you mentioned in the settings of Android Studio.

Follow all the steps and I am sure you will get the issue fix.

Fate answered 19/7, 2016 at 7:8 Comment(2)
I tried all the steps to no success. I now receive 5 new errors after trying your procedure. I do not believe I have multiple instances of ADB runing on the system and I do not believe I am using Genymotion. I attempted to post the new errors above. Thank you.Aman
@RandallReynolds, Can you try one more option by clearing the caches? 1) File => Invalidate Caches / Restart. 2) Click on "Invalidate and Restart" button.Fate
T
7

You can clean your project with gradle wrapper of your project. In linux:

$./gradlew clean

In windows:

>gradlew.bat clean
Tehuantepec answered 19/7, 2016 at 6:34 Comment(0)
S
7

This error happens due to Gradle not synced with the project. go to Tools- Android- Sync Project with Gradle files. Then Run it again. On newer Android Studio versions, go to File-> Sync project with gradle files

Sherillsherilyn answered 27/1, 2018 at 21:39 Comment(1)
Other options but this saved my day.Overwinter
S
7

Very Simple. Follow this :

Build -> Clean Project

Then

Build -> Rebuild Project.

Sargent answered 3/4, 2019 at 5:35 Comment(0)
W
6

This is a terrible problem, i have facing it so much time, First of all when you run on emulator or real device please make sure that it is not show device is offline in Android monitor, see picture below due to bad cable connection device is showing offline, so make sure first that it is online.

enter image description here

If it's Okay then clean your project and Rebuild your project. You can do it from Build -> clean project / Build-> Rebuild project

Still problem occurs then try to Restart android studio. This is generous error happens due to above cases.But i solve it this way as described.

Walkway answered 19/7, 2016 at 6:49 Comment(1)
due to bad cable connection device is showing offline was my problem. Thanks!Morel
A
6

None of the above worked for me, the simplest solution was to go to

File > invalidate caches/restart > invalidate and restart

enter image description here

Atomize answered 7/2, 2017 at 19:59 Comment(0)
V
5

This issue seems to be bug in Android Studio.

I tried all other workarounds but the issue was appearing randomly.

I also have custom named apk for output. But Android studio was randomly picking custom apk name and default apk name.

Adding Gradle-aware Make solved the issue.

Following are the steps.

  1. Menu Run -> Edit Configuration

  2. Select "app" configuration

  3. Add Gradle-aware Make to Before Launch actions

You are done.

enter image description here

enter image description here

enter image description here

Following article helped me in finding the solution https://android.jlelse.eu/android-studio-3-1-how-to-fix-it-b49f72eb054f

Veroniqueverras answered 7/3, 2019 at 14:43 Comment(2)
Worked for me. +1'dBrackish
It was happening with only one of my project. This solution worked for me. How is it possible that app does not build for one project only & work for others?Organzine
A
4

It's a bit late for reply but, i've figured out how to solve this problem on Android Studio 3.1.

You can have "Instant Run" checked, what you need to do it's just to build an APK

enter image description here

and then retry to Run your app.

Hope this help!

Acumen answered 9/4, 2018 at 9:40 Comment(0)
M
3

In my case, my project location contained the special character.

E:\Android_Projects\T&PUIET,KUK\app\build\outputs\apk\app-debug.apk

close android studio > rename folder containing the special character(here T&PUIET,KUK ) > restart android studio.

Hope this Solution helps!

Martingale answered 27/1, 2017 at 21:10 Comment(0)
R
3

Clean and Rebuild is working fine for this problem and it is good also than other solutions.

Reyna answered 6/10, 2018 at 6:23 Comment(0)
P
3

In my case my device didn't have enough memory. After trying out a number of the suggestions here, I finally noticed the notification on my phone about low memory. The notification had been there for hours apparently.

Powerhouse answered 23/4, 2019 at 2:49 Comment(0)
A
2

I could install app on Nexus, but couldn't on Samsung. Nothing helped me except the change of the USB cable.

Axil answered 23/12, 2017 at 9:15 Comment(1)
I solved it by inserting the cable in another USB portHembree
K
2

mi users if you are facing this type of issue follow these steps:

Step 1 : generate developer options as follow Settings>>About Device>>Click 7 times on MIUI Version>> It will Generate Developer Options.

Now Enable Following...

Step 2: Setting>Additional setting> Developer options> Enable USB Debugging

Step 3: Setting>Additional setting> Developer options> Enable Install via USB Note: Its Will get Enable Only If You Insert SIM In MI Device/Phone.

Step 4: Setting>Additional setting> Developer options> Enable Verify apps over USB.

all done now run the project and test....


non mi user:

just enable once instant run options from the settings--> Build,Execution, Deployment-->Select Instant Run and Enable Check Click On OK...

Its Will Work....

Kittiekittiwake answered 29/12, 2018 at 7:37 Comment(0)
K
1

Try to this way :

1) In Instance Run is Enable then desable it. 2) Save it and Rebuild the project. 3) Check devices is online or USB debugging On your device. 4) Then Run It App On your devices.

Note :

If you use mobile device is MI (Xiaomi) Then Check : => setting>Additional setting> Developer options> Install via USB (ON it) => setting>Additional setting> Developer options> USB debugging (ON it) => setting>Additional setting> Developer options> Verify apps over USB (ON/Off it)

Kaenel answered 27/4, 2018 at 5:28 Comment(1)
Still You are facing the problem mean follow Install Via USB will no ON, Until you insert SIM Card In the MI Phone and Run The ProjectKittiekittiwake
E
1

Trying cleaning AND rebuilding your project: In Android Studio, open up the Build tab at the top left and try both the Clean and Rebuild options.

Entertainment answered 26/5, 2018 at 11:2 Comment(0)
L
1

This problem occurs when you copy paste class and didn't change package name. Means Package name are different. Build has no problem to build but its problem to install.

Lloyd answered 29/7, 2019 at 11:40 Comment(0)
P
1

After trying the different solutions from the different answers, I tried changing the USB debugging cable, and the problem resolved finally.

Prosecute answered 1/3, 2020 at 5:56 Comment(1)
How are you bro?Bribe
W
0

In my case, going to Settings>Build, Execution, Development>Compiler>Command-line options and removing the --dry-run flag fixed it for me. Not sure why that was there in the first place, but it solved it for me.

image

Waitress answered 20/9, 2016 at 9:32 Comment(0)
T
0

I was facing same problem.Tried every think mentioned here in blog.

But it was basic error to permit device "allow installing app from USB" which did it for me.

Tybalt answered 3/1, 2017 at 4:54 Comment(0)
V
0

I had similar problem. In my device I have two accounts and the app was remained installed in another account. I have deleted app from both of the accounts and it was done.

Vitellus answered 6/2, 2017 at 6:9 Comment(0)
O
0

I was able to resolve it simply by opening the notification bar of the android phone , clicking on "tap for more options" and selecting PTP

Odds answered 22/2, 2017 at 15:42 Comment(0)
W
0

i was also getting the same error repeatedly but could not solve it as i am complete new to android development. But then it came to my mind that the error is appearing because its not able to install the apk in the device as the error says. So i make sure that my Oneplus3 is in debugging mode and also allowing file transfer when connected via USB. And this solved the problem.

Also previously it was not doing the instant run but now it does.

So check whether your android device is allowed to transfer files while connected via USB. This might help.

Wyman answered 25/2, 2017 at 7:33 Comment(0)
T
0

Look at screenshot

Here is gradle console updates:

5:01 PM Gradle build finished in 1s 252ms

5:13 PM Executing tasks: [:app:assembleDebug]

5:13 PM Gradle build finished with 15 error(s) in 1s 125ms

5:15 PM Executing tasks: [:app:assembleDebug]

5:15 PM Gradle build finished with 13 error(s) in 1s 608ms

5:16 PM Executing tasks: [:app:assembleDebug]
Therapsid answered 11/4, 2017 at 14:1 Comment(0)
O
0

Turning off the instant run(File >>Settings >>Build,Execution,Deployment >> Instant Run), solved my issue

Oakman answered 12/6, 2017 at 6:33 Comment(0)
A
0

I was using CyanogenMod 12.1 and was building with libgdx when I met with the same error. Rebuilding didn't work for me. My phone was connected as UMS or USB mass storage to my PC when I ran the app. Just changed the USB configuration from mass storage to MTP and it fixed my problem.

Avelar answered 21/7, 2017 at 6:27 Comment(0)
S
0

Looking at the error message, Android Studio tried to install older version of apk (lets say 0.5.1) while current version is lets say 0.5.2. Android Studio builds 0.5.2 but tries to install 0.5.1 for some reason.

I have turned off Instant Run, invalidated and restarted, rebuilt project and didn't help.

Solution worked for me is to uninstall the app, then change the current branch on VCS to some other branch. Then come again to latest branch and Rebuilt, Install the APK again.

Sweetscented answered 27/7, 2017 at 8:16 Comment(0)
B
0

You just need to restart your adb. Instruction for that is given in this Link

Barium answered 19/9, 2017 at 14:3 Comment(0)
L
0

Odd reasoning for me - I had deleted the project and pulled from repo. Because of this, the build/ files were missing.

Listless answered 9/4, 2018 at 7:9 Comment(0)
K
0

terminal:

  • deleting "build and gradle" folders under project/android

  • cd android && ./gradlew clean && cd .. && react-native run-android

  • cd android && ./gradlew clean &&

Keyser answered 15/4, 2018 at 21:43 Comment(0)
O
0

Revoke USB debugging authorizations and then disable USB debugging on your mobile. Re-enable USB debugging, then connect to the USB port. It will ask USB debugging permission for the specific computer. Select "Always allow from this computer", then press OK. This worked for me.

Overhasty answered 3/6, 2018 at 14:10 Comment(0)
H
0

If your device is listed, but shown as "OFFLINE", yet no popup to accept USB debugging has occured on the phone: Disconnect/reconnect USB cable, and the popup may show.

Probably this is a common cause, it's mentioned by others, but not in simplest terms.

Heigl answered 16/12, 2018 at 16:33 Comment(0)
T
0

your device can be the problem too

'cmd package install-create -r -t --full  -S 85640035' returns error 'Unknown failure: Exception occurred while executing:
        android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space
        at android.util.ExceptionUtils.wrap(ExceptionUtils.java:34)

when there is not enough storage

Toreutic answered 19/4, 2019 at 13:31 Comment(0)
G
-1

Try this: 1) Clean project 2) Rebuild project 3) Turn off Antivirus 4) Run App

Goodson answered 12/12, 2017 at 8:30 Comment(1)
Why the late and less complete (@Quick League Developer) answer?Corina

© 2022 - 2024 — McMap. All rights reserved.