I recently switched to connecting to the phone via WiFi. I am able to compile and upload programs through Eclipse. However, I do not receive any logcat ouput. The phone is also shown in the DDMS view and when my program is started it also displays the name and pid. Is it possible to get the logcat trace via wireless or do I have to switch back to using a USB connection?
UPDATE:
Maybe I did not make it clear enough in my initial post. There is no problem with the connection itself. I can dump the logcat by using a terminal with 'adb logcat -d'. What I want is to see the live logcat in Eclipse's logcat viewer. Not sure if it is of any importance, but I am using Eclipse 3.8 in Debian Jessie.
(1) connect phone with usb, then type in command line:
adb tcpip 5555
you can disconnect your phone from usb now
(if the reason for using wifi is that usb does not work on your machine, just do the above on another computer
(2) find out the IP address of your mobile device (somewhere under settings .... phone status)
(3) in command line type:
adb connect [IP of your mobile]
NOTE: all devices need to be connected to same wifi; avoid using public wifis
In your eclipse,
just go to: windows->preferences->Android->logcat and follow the following setup:
1. double-click action: "go to problem (error line)
2. switch to: java
3. both checkboxes are checked
if setup is fine, clean the project and restart eclipse
Restart Your ADB Server
1) open cmd
2) change directory to platform-tools
3)type adb kill-server
4)then adb start-server
I am not sure what exactly happened, but it is working now. I did not do anything that I had not tried earlier. It just started working after several attempts. Might be a faulty Eclipse installation, it did crash earlier today.
Related
I am currently working on eclipse, but I am unable to connect my device to Eclipse. It's visible in the system and i have enabled debugging option as well. I have searched a lot on internet but now I'm hell fedup. Please help.
Device cannot connected has many reason.
I think the first you should check the device work mode,some device has PTP or MTP mode,you should try change the mode.http://lh3.ggpht.com/-8UMNs7Vg_dY/UVC6_6PnbDI/AAAAAAAAAIg/NjKOvAp9cDs/02-select-camera-ptp-mode_thumb%25255B1%25255D.png%3Fimgmax%3D800
Next you can check the adb port is other program is using.You can open DDMS,try this reset adb option(http://i.stack.imgur.com/Ev8Z3.jpg ). Or open terminal and execute command lsof -i:5037.This is adb work port. If some program use it. Use command kill -9 {pid} kill the program.
Finally you can try using another cable.
I am trying to debug an app with Intellij 13.0 on Windows 7.
Whenever I start debugging I get the following warning:
Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse"
I have tested it on a device and in the emulator.
The only thing I have open is Intellij. I tried also with closing adb before I start debugging, but nothing changed.
For me this situation occured when device was connected via usb and adb tcpip was enabled (ADB in Wi-Fi mode).
Just run command adb usb with connected device and try to debug again.
Turn the USB Debugging on Device in Developer Options to off.
And then switch it back on.
This solved the issue in my case.
UPDATE
One more thing which fixed my case was clearing all existing breakpoints. And then trying to debug again.
I used adb kill-server in the console to get the Logcat to appear. Running Android Studio 1.02.
For those who are using Android-Studio: check your gradle file and product flavours and be sure that "debuggable" attribute in manifest is NOT set to false.
First make sure you close any application use ADB , DDMS
like if you open Eclipse with android studio
Second restart your ADB from terminal
adb kill-server
adb start-server
if you cannt find terminal use this image to guide you
if this doesn't work with you close android studio and open it again
the cause of error , many application share ADB this why you cant start debugging
Had similar problem in Android Studio (0.5.1) with SDK 18.0.1
Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse
As you suggested updating the SDK worked. Now running on 19.0 and the problem got resolved.
You can restart ADB in windows without writing any commands.
Just open Task Manager
Sort the list by name
Find process named "adb"
Right click on it and then select "End Task"
Done
Next time you run any app the adb will start with a new instance.
A pretty straight forward solution is running the following commands in the command Terminal of Android Studio :
adb kill-server
adb start-server
and then try debugging again. It should be working now.
The same issues occured with me all of a sudden while debuging an app on my samsung galaxy S6
This is what worked for me :
closed android studio
killed adb , using adb kill-server
removed all of my previous breakpoints(debug points)
Restarted android studio and my phone
Restaterted Mac
did a debug without any breakpoint.
Then again did debug by putting the breakpoints again in my code, Eureka it worked. Luckily it burned only half hour of mine.
This is a problem of ADB connections as sometimes ADB cache a dead connection on your real/virtual device and due to which the port is busy and u cannot connect to it.
The simplest solution to this is RESTART your ANDROID phone that's it.
Are you using adb through WiFi? That might cause debugging issues.
If so connect your mobile to your pc thru usb and debug again that should fix it.
This happened to me and the thing I did was to set
android:debuggable="true"
in <application> tag...like:
<application android:allowBackup="true"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:largeHeap="true"
android:icon="#drawable/icon"
android:debuggable="true"
>
This fixed the problem with later SDKs.
Below steps worked for me(If you are connected via USB debugging),
Go to the Developer options of the phone
Disable USB debugging and all other authorisations for USB debugging.
Enable back all
Now try to debug again, hope it will work.
When I'm using a rooted Android device as ADB host to send adb command "adb devices" to Samsung S4, I received device unauthorized error message. However when I tried adb to Samsung Galaxy Nexus, it is working fine. Can anyone advise how to solve my Samsung S4 problem?
=========================================
# adb devices
List of devices attached
4d00f9169907301b unauthorized
=========================================
Edit:
Found that this problem only happened to Android 4.2.2 and above. The following link explained that Google has implemented some new security features for using adb.
http://nelenkov.blogspot.com/2013/02/secure-usb-debugging-in-android-422.html
Appreciate if anyone can help on this.
Get the public key from the client phone (adb host)
cat /data/.android/adbkey.pub
copy the above public key to the target phone's /data/misc/adb/adb_keys location. (you may need to stop the adb daemon first with stop adbd)
cat /data/misc/adb/adb_keys
verify both cat outputs match.
try restarting adb daemon on target start adbd or just reboot them.
If you are having problems reading or writing to ADB KEYS in above steps, try setting environment variable ADB_KEYS_PATH with a temporary path (eg: /data/local/tmp). Refer to that link it goes into more details
"On the host, the user public/private key pair is automatically generated,
if it does not exist, when the adb daemon starts and is stored in
$HOME/.android/adb_key(.pub) or in $ANDROID_SDK_HOME on windows. If needed,
the ADB_KEYS_PATH env variable may be set to a :-separated (; under
Windows) list of private keys, e.g. company-wide or vendor keys.
On the device, vendors public keys are installed at build time in
/adb_keys. User-installed keys are stored in /data/misc/adb/adb_keys"
Check and uncheck the USB Debugging option in the device.
If that doesn't work unplug and plug in the USB a couple of times.
At some point, the device should show a message box to ask you to authorize the computer. Click yes and then the device will be authorized.
If anyone has similar issue of having a phone with a cracked screen and has a need to access adb:
Root your phone (mine was already rooted, so I was blessed at least with that).
If you forgot to enable developers mode and your adb isn't running, then do the following:
Reboot your phone into recovery.
Connect the phone with a cable.
Open terminal.
If you type adb devices you should see the device in the list.
If so, type:
adb shell mount /system
abd shell
echo "persist.service.adb.enable=1" >> default.prop
echo "persist.service.debuggable=1" >> default.prop
echo "persist.sys.usb.config=mtp,adb" >> default.prop
echo "persist.service.adb.enable=1" >> /system/build.prop
echo "persist.service.debuggable=1" >> /system/build.prop
echo "persist.sys.usb.config=mtp,adb" >> /system/build.prop
Now if you are going to reboot into your phone android will tell you "oh your adb is working but please tap on this OK button, so we can trust your PC". And obviously if we can't tap on the phone stay in the recovery mode and do the following (assuming you are not in the adb shell mode, if so first type exit):
cd ~/.android
adb push adbkey.pub /data/misc/adb/adb_keys
Hurray, it all should be hunky-dory now! Just reboot the phone and you should be able to access adb when the phone is running:
adb shell reboot
P.S. Was using OS X and Moto X Style that's with the cracked screen.
Have you tried
adb kill-server
adb shell
Sometimes adb gets stuck and first killing adb server and then starting some command forces authorization window to pop-up.
Also please check adb client version on your phone.
THis feature is supported from adb 1.0.31 as far as I remember.
Experience With: ASUS ZENFONE
If at all you have faced Missing Driver for Asus Zenfones
Follow This Link
(http://donandroid.com/how-to-install-adb-interface-drivers-windows-7-xp-vista-623)
I tried with
1) Killing and starting adb server at adb cmd.
2) Switching Usb Debugging on and Off and ...
This is What WORKED with me.
Step 1:Remove Connection with Device and Close Eclipse
Step 2:Navigate to C:/Users/User_name/.android/
Step 3:You Will Find adb_key
Step 4:Just delete it.
Step 5.Connect again and System will ask you Again.
Step 6.Ask Device to remember RSA Key when it Prompts. I think its done.
If you Face The Same Problem after couple of days, just disable and enable USB debugging
For unknown reasons, I only had ~/.android/adbkey, but not ~/.android/adbkey.pub.
I guess that adb was unable to push the public key to the device, and thus the device could never show the authorization dialog.
After killing the adb server, removing the adbkey file and starting adb again, the authorization dialog popped up on the phone.
Try this steps:
unplug device
adb kill-server
adb start-server
plug device
You need to allow Allow USB debugging in your device when popup.
You need to allow Allow USB debugging when the popup shows up when you first connect to the computer!
Delete the folder .android from C:/users/<user name>/.android. It solved the issue for me.
I had to check the box for the debugger on the phone "always allow on this phone". I then did a adb devices and then entered the adb command to clear the adds. It worked fine. Before that, it did not recognize the pm and other commands
For me, the emulator could not have Google Play Services enabled. It could have Google APIs or be x86 or x64 but not google play store.
Try a USB2 port if you're plugged into a USB3 port. At least through the Pixel3 line this makes a difference. Many people have observed the same problem but I'm not sure if anybody knows why. Perhaps there's a way to tell the kernel to not do something USB3-ish on the USB port that the phones can't handle.
I got here because I forgot this workaround, found this page, then remembered to use the other port.
Please follow following steps :
Unplug your phone from system
Go to developer options of the Cellphone and then click on "Allow USB debugging" then please select the radio button prompting "Allow USB debugging when the popup shows up when you first connect to the computer!".....
That's it.. run your command again :
adb devices
You must be prompted in your s4 screen to authorize that computer. You can tell it to remember it. This is for security reasons, occurring in Android 4.4+
I found one solution with Nexus 5, and TWRP installed. Basically format was the only solution I found and I tried all solutions listed here before: ADB Android Device Unauthorized
Ask Google to make backup of your apps. Save all important files you may have on your phone
Please note that I decline all liability in case of failure as what I did was quite risky but worked in my case:
Enable USB debugging in developer option (not sure if it helped as device was unauthorized but still...)
Make sure your phone is connected to computer and you can access storage
Download google img of your nexus: https://developers.google.com/android/nexus/images
unrar your files and places them in a new folder on your computer, name it factory (any name will do).
wipe ALL datas... you will have 0 file in your android accessed from computer.
Then reboot into BOOTLOADER mode... you will have the message "you have no OS installed are you sure you want to reboot ?"
Then execute (double click) the .bat file inside the "factory" folder.
You will see command line detailed installation of the OS. Of course avoid disconnecting cable during this phase...
Phone will take about 5mn to initialize.
I am looking for a way to debug a device remotely over the Internet.
I am getting a lot of bug reports from my users which I can't even reproduce. It would be easy to solve them if I could debug the device over the Internet as if it were connected to my PC.
Is this possible?
I heard about debugging over wifi in local network, maybe there is similar way to achieve it over the Internet?
It is possible to setup Android device for debugging over Internet, however it requires USB connection to enable it or root access on the device. In addition to that you will have to setup port forwarding to device to accept incoming ADB connections from the the Internet. It hardly can help unless users of your app are developers with great desire to cooperate.
You can find detailed instructions here:
http://www.cleansoft.lv/debugging-android-applications-remotely/
Steps to Follow:
First In Android Settings Application go to About Device option.
Click 9 times on Build Number option, so that you can unlock Developer Options setting.
Now In you Setting's Application, you will have Developer Options enabled, go and click on it.
set following options on : Stay Awake, USB Debugging and if you have Internet Adb option in menu set that also enabled if not then dont worry continue the steps.
Now open your Android Studio and the application you want to run on the android device.
In Android Studio, at bottom click on Terminal tab, Terminal window opens.
Now through your terminal go to the directory where your Android SDK is stored
In SDK directory go to platform-tools directory.
Now if you list the files in the platform-tools you will see adb there.
Running following Commands.
as an example.
adb connect <ip-address-of-your-device>:5555
as an example:
adb connect 10.10.0.21:5555
The terminal should show something like below
adb server is out of date. killing...
*daemon started successfully*
connected to 10.10.0.21:5555
Now run shell command
adb shell
you will get the prompt something like this, i my case i used android x86 device for debugging.
shell#x86_64:/$
Now if you go to the task bar in the android studio and click on Run options and then Run'app' you will be able to see the device as your Deployment Target.
Hope it helps !
You can use Crashlytics in your app.. It helps you to get the detailed crash logs. Whenever an app crashes, it will send you the detailed crash report, from which you can figure out what is happening at the client side.
Get more info about adding crashlytics to the app from here.
Send this new app to the client so can have workaround:
You can also use adb via tcp ip:
adb connect ip:port
Use a remote access (teamviewer or droid apk) to enable debugging in android developer tools.
In the router where the android is connected remember to create port forwards to the android ip.
In your machine with adb installed do:
adb connect public_ip:port
After being connected, you can do:
adb logcat
or
adb shell
Or any adb command you want to.
try Debugging Firefox for Android over Wifi it's working with me
https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_for_Android_over_Wifi
There are lots of times Eclipse can't connect to emulator that I turned on from AVD Manager, and just starts a new emulator by itself,( two emulators are the same ):((. How can I make eclipse find the emulator ?
some times restarting adb solves your problem
adb kill-server
adb start-server
for working easier in command line in windows, add the path of adb.exe to that Windows' path. For example add ";C:\Program Files\Android\android-sdk\platform-tools" to System Properties-> Advanced-> Environment Variables-> System Variables-> Path
One of the reasons of problems in device connection is a long USB cable or a two-piece cables like keyboard USB. try to connect your device to PC directly by a short cable.
I guess that you might suffer from the issue that the manually started emulator got disconnected somehow, shown with a message like
Error: emulator-5554 disconnected
in the Eclipse console view. There are several related questions and answers on stackoverflow like Why do I get a emulator-5554 disconnected message,
but for me none of those answers helped.
Whenever I see the error message for disconnection occur, I just shutdown that emulator and start it again. Normally that already "fixes" the problem, it just works on the next attempt (for me).
I was just experiencing this issue also. I agree with breceivemail, the ADB reconnected to the emulated device after reset, but there is a shortcut using Eclipse:
In the DDMS view => Devices window => View Menu (the down triangle in the header) => reset adb
You can choose the target device manually by changing the run configurations.
Run -> Run configurations -> choose your App -> Target tab -> select "Always promt to pick device"
If your device isn't available you will at least don't start a new Emulator.
If the emulator is still active, you can use adb to connect to it via tcp. In this way you can connect a disconnected emulator to your development system's loopback one port higher, just like if you are using emulator-5554, you can connect to it by using a higher port.
adb connect localhost:5555
There was been an issue with this technique, where the emulator control becomes inactive, and the developer cannot send GPS coordinates or SMSs or calls to emulator.
There is a one click method to do this
Open notepad
Type the below code
#echo off
adb connect localhost:5555
Save the file as your_file_name.BAT
Copy the file to Android SDK/platform_tools
Create a shortcut, give it a custom icon, use it anywhere you like
Open the DDMS view from Eclipse, and simply click on the emulator name you want connect to in 'Emulator' tab.