Android Studio: Failure [INSTALL_FAILED_INVALID_AP

2019-08-10 05:43发布

I have the following problem when running my app:

Waiting for device.
Target device: samsung-gt
Uploading file
    local path: C:\Users\kwmaster\AndroidStudioProjects\Count500\app\build\outputs\apk\app-debug.apk
    remote path: /data/local/tmp/xxxxx
Installing xxxxx
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/xxxxx"
pkg: /data/local/tmp/xxxxx
Failure [INSTALL_FAILED_INVALID_APK]

Why did it not let me install the apk???

6条回答
smile是对你的礼貌
2楼-- · 2019-08-10 05:54

In my case (I have a rooted device) and when I rooted, something happened with my permission of /data/local/tmp and they have been changed, so adb can't get access temp file.

How I solved it:

  1. Install RootExplorer
  2. Create new tmp folder on SD card
  3. Long press on tmp folder, and select "Link to this folder" (last option in menu)
  4. Go to /data/local/ and tap button "Create link" from bottom
查看更多
爷的心禁止访问
3楼-- · 2019-08-10 06:01

I was facing a similar issue. I fixed it by first closing the Android Studio project and then deleting the .gradle folder within the project.This, forced Android Studio to rebuild it when I opened it again, and then it fixed the issue.

查看更多
祖国的老花朵
4楼-- · 2019-08-10 06:07

For those that will encounter this problem in the future just go in build.gradle and put at applicationId just put a name with a point betwen 2 words.Example: First.Test

查看更多
唯我独甜
5楼-- · 2019-08-10 06:07

when I cd /data/local/tmp, I found my project name in the folder. So I solved the problem as follows:

  1. adb shell
  2. cd /data/local/tmp
  3. rm -r your project name. For example: rm com.example.pc002.intenttest1
查看更多
淡お忘
6楼-- · 2019-08-10 06:14

I was also having this problem because of changing package name. So do check your package and sub packages names and also in manifest file where activities defined with package name.

查看更多
放荡不羁爱自由
7楼-- · 2019-08-10 06:15

As AndroidGuy thought there was a problem in build.gradle - the gradle version ws wrong. I also have changed in the settings to use the default gradle wrapper and not the local stuff!!!

查看更多
登录 后发表回答