I can use all adb features, but when i try to adb -r install /package.adb it just gives me:
"2858 KB/s (4116553 bytes in 1.406s)"
and thats it, nothing happens. When I do it on another computer it deploys application and restarts it. What can be wrong?
Try running this command after your install:
adb shell am start -a android.intent.action.MAIN -n your.package/.possibleSubfolder.MyMainActivity
Related
I tried to use the following code, but reported to me "shell does not declare android.permission.REQUEST_INSTALL_PACKAGES"
adb shell am start -a android.intent.action.VIEW -t "application/vnd.android.package-archive" -d "file:///sdcard/Download/a.apk"
I am sad that for some reasons, adb install is not allowed, even if I run the following command, I still cannot install the application
adb shell settings put global verifier_verify_adb_installs 0
adb shell settings put global package_verifier_enable 0
log:Failure [INSTALL_FAILED_VERIFICATION_FAILURE: adb install not allowed!]
I am trying to skip the chrome welcome screen when running tests. The problem is other solutions that I have found like this one don't seem to work anymore.
Commands used:
$ adb shell pm clear com.android.chrome
$ adb shell 'echo "chrome --disable-fre --no-default-browser-check --no-first-run" > /data/local/tmp/chrome-command-line'
$ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
The solution for me was actually a combination of the question and this answer. The solution can also be found in another question/answer, though it's not entirely clear.
The following should work:
$ adb shell am set-debug-app --persistent com.android.chrome
$ adb shell 'echo "chrome --disable-fre --no-default-browser-check --no-first-run" > /data/local/tmp/chrome-command-line'
$ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
Some notes:
In the Chromium project documentation, it's mentioned that for the command line file to be used, the user should
"Enable command line on non-rooted devices" in chrome://flags
Setting Chrome as the debug application replaces this requirement.
In older device versions, the command line file was expected in /data/local. This folder is no longer writable from adb shell in non-rooted devices, so /data/local/tmp should be used instead. This is documented in this bug
In the ChromeSwitches.java current source code, only --disable-fre still exists. The other flags might be required in older Chrome versions, but I didn't verify.
What is your OS version? It is working on Android 10. You can try the below commands:
$ adb shell pm clear com.android.chrome
$ adb shell am set-debug-app --persistent com.android.chrome
$ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
I'm developing apps for Android Wear and Android Phone devices. Both apps are in a common project in Android Studio. In fact this application uses three wear devices that work together with a single phone. So when I recompile for app testing, I need to build and install the apps on one phone AND three wear devices every time. Is there a way to automatically build and install to all four of these devices with one command? I imagine that a script could be run from the terminal in Android Studio, but I'm not sure where to start. Thanks.
Following the recommendations above from cricket_007, I started digging around Android Studio to see if it would report the commands for installation. I found the commands, put them in a shell script file and am now able to install the apk to four wear devices at once.
So first, in Android Studio, I go to: Build | Build APK. The generates the wear apk file. Then I execute a shell script with the following commands:
echo "Installing 422E..."
adb -s G6NZCJ00401422E push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp
adb -s G6NZCJ00401422E shell pm install -r "/data/local/tmp/com.xyz.myWearApp"
echo "Starting 422E..."
adb -s G6NZCJ00401422E shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
echo "Installing 6227..."
adb -s G6NZCJ004076227 push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp
adb -s G6NZCJ004076227 shell pm install -r "/data/local/tmp/com.xyz.myWearApp"
echo "Starting 6227..."
adb -s G6NZCJ004076227 shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
echo "Installing 922a..."
adb -s G5NZCJ02746922A push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp
adb -s G5NZCJ02746922A shell pm install -r "/data/local/tmp/com.xyz.myWearApp"
echo "Starting 922A..."
adb -s G5NZCJ02746922A shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
echo "Done."
echo "Installing Moto…”
adb -s localhost:4444 push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp
adb -s localhost:4444 shell pm install -r "/data/local/tmp/com.xyz.myWearApp"
echo "Starting Moto…”
adb -s localhost:4444 shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
echo "Done."
Of course, this could be extended to install the mobile app as well. I'm sure that I can find the gradle command to actually compile the .apk file as part of the script. If I find that, I will also post it.
I just changed my PC, and now I have a problem with Android Studio, every time i try to run or compile an app it install it correctly, but then it cannot start the main activity of the app, if you need it this is the full Android studio output:
Waiting for device.
Target device: samsung-gt_i9000-3733E37B1ACB00EC
Uploading file
local path: C:\Users\Federico\swagmasta\TurnarioConapo1.0\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/feddycapdev.conapo.turnario
Installing feddycapdev.conapo.turnario
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/feddycapdev.conapo.turnario"
pkg: /data/local/tmp/feddycapdev.conapo.turnario
Launching application: feddycapdev.conapo.turnario/feddycapdev.conapo.turnario.MainActivity.
DEVICE SHELL COMMAND: am start -D -n "feddycapdev.conapo.turnario/feddycapdev.conapo.turnario.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error: Adb refused a command
I tried to manually run am start -D -n "feddycapdev.conapo.turnario/feddycapdev.conapo.turnario.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER from the adb shell, and it work correctly, some ideas on how could i fix it?
UPDATE : I tried running as admin, rebooting PC, reconnecting cable, killing all the adb.exe processes, killing the adb server and restarting it, noone of this worked.
Maybe it's a problem of driver? I'm using a Samsung Galaxy S for debugging, at the beginning the PC didn't recognized it, so I installed samsung USB driver, so maybe that's the real problem, but if i can install app to my device via adb the driver should be working right?
Please kill and start adb server from console or terminal using following commands:
adb kill-server
adb start-server
If it does not help try to restart your computer.
If you are getting
adb command not found
error then you have to go in platform-tools directory in Android SDK.
hope it helps!
It could be blocked by some other instance of adb.
Look into your task manager if you are not running another instance of adb.
when you run a binary in adb shell, if you exit adb, then the process is over too.
So is there a way to run a binary without adb's help?
If you have busybox installed on your device, then you could use 'busybox nohup [your binary] &' command. This way it will keep running even after you close adb
This works for me:
sh -c "your-binary-or-command" &
Then you can exit the adb shell by pressing ctrl+D and it will continue to run.
You can kill it by going back into the adb shell then
kill -s KILL <PID>