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.
Related
When trying to debug my app, the installation of the APK works fine, but starting the debugger, gives the error "Device is offline":
01/17 15:56:08: Launching app
$ adb push /home/bf/Projects/.../app-full-debug.apk /data/local/tmp/nl.my.app
$ adb shell pm install -t -r "/data/local/tmp/nl.my.app"
Success
APK installed in 3 s 918 ms
$ adb shell am start -n "nl.my.app/nl.my.app.activities.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Device is offline
I tried updating the SDK, to no avail. Running the same app on another device works fine.
Also, when launching (in the "Select Deployment Target" screen), it doesn't give me any information, only serial number and [null], while I get full info on other devices (make and model, etc)
I didn't resolve the issue itself, but using TCP/IP debugging did work:
~$ adb tcpip 5555
~$ adb connect <ipaddr>:5555
the device is now shown with all information in the "Select Deployment Target" screen as well.
I am running a headless emulator (Android api 25) on a Ubuntu linux 14 server and I see the below output for the command-
$./adb devices
List of devices attached
emulator-5556 device
However, If i try to run any other command I get error
$./adb shell dumpsys deviceidle get deep
Can't find service: deviceidle
$./adb shell 'pm list packages -f'
Error: Could not access the Package Manager. Is the system running?
How can i verify that my emulator is functional?
is adb devices -l not working? it should show you the status of the device as well
try adb push, for eg
adb push foo.txt /sdcard/foo.txt
or adb install for eg
adb -s emulator-5556 install apkname.apk
these commands will work with any running emulator/device
all these commands are available on the documentation
So, i just updated my Android Studio from 1.5.1 to 2.1 Preview 1 thru canary channel . Now when i was trying to run my app on my device then i had to face these errors.
03/16 18:40:12: Launching app
$ adb push D:\Workspace\MyApplication\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.shienh.myapplication
$ adb shell pm install -r "/data/local/tmp/com.shienh.myapplication"
Segmentation fault
$ adb shell am start -n "com.shienh.myapplication/com.shienh.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..
What could be the reason for such an error.
And yes, app was not installed on device.
I don't know why it's not working, it's not depends on Android Studio version. Maybe did you make any mispelling? Make sure that grammar of this command is correct.
For pushing app on device, unistalling it or clearing user data consider to use this IntelliJ/Android Studio plugin:
https://github.com/pbreault/adb-idea
It gives you direct access to pimary adb commands, like in an image below:
Just in your IDE choose File -> Settings -> Plugins -> Install from repository(second option)
Search for ADB IDEA and install the plugin.
Hope it help
It used to work fine, but today after I connected my Android phone to my machine, and run adb devices, I got the following error:
* daemon not running. starting it now on port 5037 *
cannot bind 'tcp:5037': Address already in use
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon: Operation timed out
How to solve this problem? (I am using a MacBook)
Try with following commands
Find port details by List Open Files lsof command.
sudo lsof -i :5037 and find PID and kill it.
kill -9 <pid here>
Example: kill -9 4363
Then start adb server. adb devices command.
Kill the Adb server and restart.
adb kill-server
adb start-server
I managed to solve this problem on MacBook by first running the following command to list the process which is using port 5037
lsof -n -i4TCP:5037 | grep LISTEN
Then, I kill it:
kill -9 <PID>
Then, adb devices works!
Android Studio Terminal
$ adb devices
List of devices attached
adb server is out of date. killing...
cannot bind 'tcp:5037': Address already in use
ADB server didn't ACK
* failed to start daemon *
error:
error:
OS Terminal
$ adb devices
List of devices attached
adb server is out of date. killing...
* daemon started successfully *
Finally test again at the IDE terminal
$ adb devices
List of devices attached
GL
it is clear that Address already in use. busybox netstat -antp to check who is using the port.
I've fixed the problem by updating the Android SDK.
android update sdk --no-ui
Additionally, I've updated the Platform Tools to the newest version.
If this doesn't work, redownload android sdk.
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz cd android-sdk-linux/tools
install all sdk packages
./android update sdk --no-ui
I tried it at the OS Terminal, worked.
Try on the OS terminal first
Running the following command at the OS bash helped solve the issue:
sudo adb start-server
I ran adb kill command and then it started working fine
adb kill-server
adb start-server
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