10

This is what I see when I try to install my app on my device (I'm using Android Studio 0.8.2):

Waiting for device.
Target device: samsung-gt_s7500-cf994b04
Uploading file
local path: C:\Users\Administrator\AndroidStudioProjects\Testaqua\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.example.administrator.testaqua
Installing com.example.administrator.testaqua
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.administrator.testaqua"
pkg: /data/local/tmp/com.example.administrator.testaqua
Failure [INSTALL_FAILED_INVALID_URI]

What in the seven hells does this error mean?

[Edited] I installed my app on another rooted device, and it worked; it seems the problem is my device, android studio is running fine.

ben75
  • 29,217
  • 10
  • 88
  • 134
elmazzun
  • 1,066
  • 2
  • 18
  • 44

5 Answers5

20

I get similar error message, I fixed it by passing the absolute path instead of filename, e.g. inside adb shell, this command will shows:

shell@example:/sdcard $ pm install -r -d app-release.apk
        pkg: app-release.apk
Failure [INSTALL_FAILED_INVALID_URI]

Change it to absolute path fixed that error message, e.g.:

pm install -r -d /sdcard/app-release.apk

[Second reason]

Another reason is the file not exist. It happen when I interrupt adb push <apk> /sdcard/ by Ctrl+C recently. Re-push apk twice required.

[Third reason]

This error occurred if the apk reside /mnt/runtime/default/<thumb_drive_mounted_directory>, I have to move the apk to /sdcard/ first to install.

林果皞
  • 7,539
  • 3
  • 55
  • 70
10

From this blog try this :

Change permission of /data/local to rwxrwxrwx (normally it must be rwxrwxrw-)

i.e. grant execution privileges to all users.

ben75
  • 29,217
  • 10
  • 88
  • 134
2

symptoms: `

$ adb install xyz.apk
[100%] /data/local/tmp/xyz.apk
    pkg: cat
    ver: /data/local/tmp/xyz.apk
Failure [INSTALL_FAILED_INVALID_URI]

solution:

check if u have allow installation from unknown sources enabled :)

enter image description here

ceph3us
  • 7,326
  • 3
  • 36
  • 43
1

Finally, I found the reason is dir and file permission.
Android seems to use another user to access the dir and file.

chmod 775 /data/local/tmp/somedir         ==> rwxrwx<b>r-x</b><br>
chmod 774 /data/local/tmp/somedir/a.apk   ==> rwxrwx<b>r</b>--<br>

The above setting will be OK!

Mohammad Kholghi
  • 533
  • 2
  • 7
  • 21
osexp2000
  • 2,910
  • 30
  • 29
0

It happened with my Flutter app once. Removing apk file from your-project-name\build\app\outputs\apk\debug and running the app again solved the issue. Before this issue happened, I closed running Flutter app manually from the phone while it was still attached to terminal and running.

Elmar
  • 2,235
  • 24
  • 22