Android Logcat not showing logs when I switch devices - android

I am trying to use Logcat to help diagnose my android issues. I frequently have a phone plugged in AND an emulator running. Sometimes I debug on the emulator, sometimes I debug on the phone, or maybe even a third device.
Logcat does not continue to show messages after a device is switched. How can I specify what Logcat does or force it to resume logging without restarting eclipse?
Insight appreciated

I've noticed this at times. Usually one of two things does the trick. First, open the Devices view, verify that the new device is showing, and then switch back to Logcat. That seems to kick Logcat into action again.
If that doesn't work, then in the Devices view menu, select "Restart ADB" (I think that's what it's called; I don't have it open at the moment).
If even that doesn't work, then kill and restart the ADB server from the command line and repeat the above.

If you are using Eclipse, switch to the DDMS perspective.
There, logcat will be showing the log of the selected device in the devices View
(Window -> Open perspective -> Other -> DDMS)

You coupld use the CLI for ADB and reattach the debug process to your switched device. Then Logcat will pick the debug msgs from that connected device. Whatever device is actively connected to ADB will output through Logcat

Related

Android stuck on "Installing" and "Launching App"

When I try to run my application via Android Studio on a virtual device, or a physical device, my Kotlin app runs the first time, but afterwards I need to disconnect my device each time I want to publish it again.
When I click on "Run App" it just says "Install" an the bottom. When I click it, it says "Launching App". I've had this problem for some time now, and I hope somebody knows the solution for this.
I've tried rebooting and turning USB-debugging off and on. Both work the first time install, just like disconnecting and reconnecting the device. After that however, again it keeps getting stuck on "Installing".
On a virtual device u could try to Open AVD Manager and then click on Wipe Data from dropDown list in actions column

Cannot run on production devices

When I run my application, the message below is printed in the error log. I don't understand if the problem is from my application or if the message is printed by my Android device.
E/NEW_BHD: Cannot run on production devices!
I read this answer Unable to run 'adb root' on a rooted Android phone , but my device is not rooted.
Why this error log is printed ?
Try enabling this function: go to Settings -> Security Just activate Unknown sources.
Now that you're ready to install your apk.
The main problem (I believe) that causes this, is your mobile's battery.
When Motorola mobiles have low battery, and they're connected to a computer, the USB option for the mobile will be forced to charging only mode.
To solve this, just swipe down from the top, click the USB for charging, touch for more options and select File Transfer. This will resolve your problem.
Try to active Developer Mode on setting of your device.
Enable Developer Options In Android 6.0 Marshmallow
Pull down on the notifications shade and open the Settings app. You can also achieve the same thing from the app drawer if you so wish.
Scroll all the way down and tap on ‘About phone’.
Now scroll down again and you’ll see an entry labelled ‘Build number’. Keep on tapping till you see a prompt that says ‘You are now a developer!’

Android Logcat: showing my app's log messages after I re-plug in my phone after 10 or more minutes later?

My Android app is successfully writing messages that I can view with Eclipse Logcat when my phone is plugged in with USB.
Now, when I'm out the the field, unplugged, my app is still producing Log.i() messages. However, when I plug my phone into my computer 10 or more minutes later, I cannot see those messages. Is there any way to view them in Eclipse Logcat? Or perhaps can I use adb shell to get on my phone and cat my messages from some file?
Sometimes you need to go to "devices" view in Debug Window and click on your device, then suddenly all the logs are retrieved

Eclipse/Android Studio Device not showing up in Chooser Dialog

I am trying to debug my android application on a device but it is not showing me any device connected in the chooser dialog. What could be the problem ?
I've tried to change connect and disconnect the device again.
I restarted the eclipse
I checked Window->Preferences->Android it shows me the SDK Targets.
What else can I do. My Computer recognizes the device but the eclipse chooser dialog doesn't show any device connected.
Please help...
There is a third party software named "moborobo" : http://www.moborobo.com/
You can install this there after you didn't need any driver for any perticular mobile device...it will automatically gets detected and you can choose it from the dialogue box. Hope this will help.
Check that your device connected as PTP device(Camera). Notification Bar -> USB Connection.
If your device connected as MTP(as common data storage) then AndroidStudio don't recognize it as debuggable device. At least that works for me and my Nexus.
There is another method that you can use .....when you run your project as android project, it generates an .apk file. Just move that .apk file to your device. Then on device run the application in debug mode.
What you can try is: killing adb.exe (using Windows Task Manager) (your IDE will restart it when needed automatically)
If you have more than one IDE open (for instance eclipse and Android-Studio): shutdown one of them, because there may have some conflicts between them when trying to connect with ADB.
If your device was never recognized through ADB (never shows up in eclipse chooser dialog, nor in Android-Studio chooser dialog): then you can try to install the generic Android Driver provided by Google (<SDK_HOME>/extras/google/usb_driver/)
I often encounter this problem, particularly when starting a particular emulator device for the first time that day. i.e. I launch my app, choose the device, the device starts up - but not before the launch of my app has timed out. I find that although the emulator device appears to have started properly - Eclipse does not recognise it as a "running Android device".
I simply shut down the device and repeat the process. I find that the second attempt is (almost) always successful - even if the app launch "times out", the emulator will be talking to Eclipse and I can then relaunch my app on the running emulator device.
Increasing the ADB connection timeout (defaults to 5000ms: Window...Preferences...Android...DDMS) may or may not help.
Hope this helps !

IDEA 11 adb I/O error when trying to attach a debugger when 2 IDEA's windows open

At this moment, this error started with IDEA 11. I still did not find the right pattern but if a device or emulator are idle for a specific period of time (not long) and if I then try to push the project to a device/emulator and to attach a debugger, first appears a message that IDEA is trying to connect to ADB (a several message windows) and then the upload starts, the apps gets uploaded, then it fails with error:
Launching application: com.xxx/com.xxx.sMain.
DEVICE SHELL COMMAND: am start -D -n "com.xxx/com.xxx.Main"
I/O Error: Connection refused
The only solution is to close both emulator and IDEA or to disconnect a real device from USB cable.
Any ideas why this is happening? As I said it happened with both device and emulator so I cannot tell that it's up to a device/emulator.
EDIT
I tried restarting ADB via shell, it did not help either. This does not happen when I simply run the project, but only when I press debug.
EDIT 2 (18May)
I've noticed that this is happening when two IDEA's screens are opened in the same time. For example, I open another project and choose to open it in new window. I first run the app in window 1, and then in window 2, but then the popup "Trying to attach to ADB" keeps opening and closing. I see that memory increases for a couple of MB as each time a new popup is created. this leads to IDEA stop responding and I have to kill it.
I think this is a new bug.

Categories

Resources