Session 'app': Error Installing APK

匿名 (未验证) 提交于 2019-12-03 03:10:03

问题:

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

回答1:

tldr; 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.



回答2:

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



回答3:

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



回答4:

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


回答5:

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



回答6:

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.



回答7:

Make sure that your device is not out of Memory!



回答8:

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



回答9:

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).



回答10:

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.



回答11:

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



回答12:

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



回答13:

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.



回答14:

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



回答15:

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!



回答16:

Just rebuild and clean project, then run project.



回答17:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!