I have been working with Monkey Talk and Xamarin Android. With my APK generated by Xamarin the Monkey Talk instrumentation would not work. Yesterday I got it to work by pushing the assemblies to the /data/data/com.app/files/.override folder. I hacked around until I got it to work and changed the chmod on some folders, added a folder to /data/data/com.app/ and got it to work.
Today I uninstalled the working build so that I could automated what I had done. After running "adb uninstall com.app" then running the install for the base APK, I keep getting "INSTALL_FAILED_UID_CHANGED".
I have seen similar threads suggesting params you can add to the uninstall.
The following did NOT work:
adb shell pm clear com.app
adb -d install -r com.apk
adb shell; rm -r /data/data/com.app (permission denied)
(push to sdcard then) adb shell pm install -l /sdcard/tmp/smv.apk
redownloading the app from the app store
If this was before I uninstalled I could have used "run-as com.app", but now since the app is no longer I can't get permissions to remove the lingering data folder. "run-as: Package 'com.app' is unknown"
I want to avoid rooting the device. But how in the world can I get rid of the old files? Can I restore the ability to use run-as? I also don't want to reinstall Android ...
Try to reboot your device before reinstalling the app. That worked for me.
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 trying to install my apk on system partition. I've rooted device and here are the steps I'm following,
adb install -d -r <apk_name>
Now apk gets installed in /data/app/<apk_name>/
Move all contents present from /data/app/<apk_name> to /system/priv-app/<apk_name>
Clear the contents within /data/app/<apk_name> and reboot the device
Post reboot not able to find my apk under adb shell pm list packages | grep <apk_name>
I'm trying to read and write value to secure setting which is asking my app to be in system partition. When I'm trying to move I'm facing this issue. I could not find something suspicious from logs while installing the apk.
Tried all possible solutions listed here (Android 5.0/Lollipop: Force rescan of /system/priv-app) but none didn't help.
Any help to debug this issue would be really helpful.
I have a System App that is capable of performing some system level tasks (Ex: remote reboot etc.). I want to try this out in the Android-Dev-Studio Emulator.
I have googled for it and this is what I've found so far:
Build the .apk
adb remount
adb push [MyApp.apk] /system/app/ (this is /system/priv-app in API Level 19+)
adb shell chmod 644 /system/app/[MyApp.apk]
adb reboot
I have done all of this. I've tried copying my apk to both folders "/system/app/" and "/system/priv-app/" folders. Regardless, when I reboot the emulator does not show anything and gets stuck.
According to this question reboot does not work for emulators which I also noticed to be correct, since the copied .apk file is lost upon restart.
What am I missing here?
I am compiling and building for SDKVersion - 21. So which folder should I copy my system app to? (/system/app/ or /system/priv-app)?
Also if reboot does not work for emulators, how do I get the app installed and running?
What's android version of your emulator?
The "/system/app/" and "/system/priv-app/" directory structure have been changed since Android L, you should use:
adb push MyApp.apk /system/priv-app/MyApp/
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 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.