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.
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.
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.
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 :)
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!
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.
Related
I am trying to uninstall an old version of my app, and reinstall the new version via ADB on a Lollipop Android device. These are my current steps:
adb uninstall com.company.mypackagename
adb install app-release.apk
adb shell pm list packages
The original uninstall of my old app was successful and the app disappeared from the Android 5.5 device.
The new attempt to install the upgraded app returns:
adb install app-release.apk
Performing Push Install
app-release.apk: 1 file pushed, 0 skipped. 10.7 MB/s (822124 bytes in 0.073s)
pkg: /data/local/tmp/app-release.apk
Success
but when I run a list of the packages, my new APK package is not there.
adb shell pm list packages
When I try to run it anyway:
adb shell am start -n "com.company.mypackagename/com.company.mypackagename.MainActivity"
I get:
Error: Activity class {com.company.mypackagename/com.company.mypackagename.MainActivity} does not exist.
So obviously it is not installing correctly, as it is not showing in packages and unable to run - even though it shows Success. What is the best way to troubleshoot this? Any help appreciated!
I finally found the issue!!!
I'm posting here because I spent way too much time trying to figure this out, since it wasn't giving me any error messages.
I was able to get a copy of the original APK from the deployment team and analyze their AndroidManifest.xml, and saw that the original APK package name was all lowercase: "com.company.mypackagename" but the one I was building was actually using Camel-Case "com.company.myPackageName". When I tried to install it, ADB should have given an error similar to: "Application ID Does not Match", but instead it just repeatedly gave me a response of: "Success".
Hopefully this saves someone else some time!
I'm having trouble installing a simple .apk file using adb. Here's what I entered and got back:
adb install test.apk
4445 KB/s (1921193 bytes in 0.422s)
In an attempt to debug I added the trace flag and got back:
adb install test.apk ADB_TRACE=1
4445 KB/s (1921193 bytes in 0.422s)
Aborted
Also, the adb devices command does list my device and when I manually copy the .apk to my device it installs/runs fine.
Help :(
Try below
adb install -r test.apk
or you need to enable to insatll unknown source app in android settings.
Not really sure what was going on, but after a system update it now works just fine.
i have a problem. When i am trying to deploy (Debug or Run) my App with the AndroidStudio, i get the following error in the RunLog
Waiting for device.
Target device: samsung-galaxy_nexus-WOVCBUF6BAGENRTO
Uploading file
local path: C:\Users\Abracadabra\Desktop\......\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/xxx.xxx.app
Installing xxx.xxx.app
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/xxx.xxx.app"
Segmentation fault
It works fine when i try to deploy it to the genymotion VM. It just does not work on my real device. It did work before, but i have cleaned up some folders there with the rootExplorer, for example i deleted a folder called ".Idea". Maybe this was a big mistake?
Is this the reason why it does not work anymore?
By the way, logcat is working fine for the rest of the phone.
Thanks for any help!
P.S. I also installed a fresh android with the CWM recovery tool and wiped all user and cache data -> did not help.
P.P.S I found out, that the apk is in /data/local/tmp on the phone. I can install it manually with the rootExplorer. but debugging is also not possible :/
P.P.P.S: I also have tried "adb install", also gives me segmentation fault.
It seems that copy is possible, but installation not.
Found out the reason. (a quite stupid one)
I forgot to enable "Security Settings -> Unknown Sources"
I encountered the same problem.
Waiting for device.
Target device: samsung-gt_n7100-4df180b77e139fdd
Uploading file
local path: C:\Users\Harshal\AndroidStudioProjects\MyFirstApp\CurrentAffairs\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.softcode.anupreet.currentaffairs
Installing com.softcode.anupreet.currentaffairs
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.softcode.anupreet.currentaffairs"
Segmentation fault
I downloaded the 'Terminal Emulator' app on my device and ran the below two commands, it was a success.
su -o pm install -r "/data/local/tmp/com.softcode.anupreet.currentaffairs"
I am trying to install apk via usb is not installing.
Device is detected perfectly .but apk is not installing.
Even i tried with the following command.
D:\Softwares\adt-bundle-windows-x86-20131030\sdk\platform-tools>adb install f:Fi
lth\Sample\bin\Sample.apk
4669 KB/s (277327 bytes in 0.058s)
D:\Softwares\adt-bundle-windows-x86-20131030\sdk\platform-tools>
First, check whether your device is connected or not. If connected, check there is only one device running i.e. mobile or emulator.
Copy your apk file and paste inside the platform-tools folder
D:\Softwares\adt-bundle-windows-x86-20131030\sdk\platform-tools>
now shift+right click on the platform-tools folder -> Open command window here
Then check whether your adb is running successfully or not.Try these command to restart adb
adb kill-server
adb start-server
now you got the message "daemon started successfully"
now just use
adb install Sample.apk
Check out the image if you still have any problem.
I am trying to install an apk (downloaded from one site) in ICS emulator through adb shell but its giving following error:
Failure [INSTALL_FAILED_UID_CHANGED]
What could be the issue?
Simply rm -r the data directory in question. If you were installing and got this error, you'd simply run "rm -r /data/data/com.app.class" from an ADB shell. If you want to try preserving the data, you could find the proper UID and then "chown -R UID:UID /data/data/com.app.class".
In Android, the part of the source code that handles installing apps is PackageManagerService. Since the Android source is public, it's easy to see where Android will throw a INSTALL_FAILED_UID_CHANGED error. If the following is true: the package you are installing already has a data directory AND the permissions on that data directory are different than the UID assigned to this package, you'll get that error.
Uninstall the previous version of the app from the emulator first, then try again. You can do this by visiting System Settings > Applications > Manage Applications and selecting the app.
If the app still fails to install, then start the emulator with the Wipe user data option selected.
Open command prompt and write below code in it:
adb devices
This will list down the number of devices attached or are active.Copy your apk in your System folder
adb -s DEVICE_NAME install YOUR_APK_NAME
through this you will be able to install your particular apk on the device by giving device name in above line.