My new Android app is crashing when I run it on my phone, but never in the emulator.
Can someone tell me where the logs are generated on the phone so perhaps I can get to the bottom of this thing?
Many thanks, Victor
You can connect your phone to your computer and debug with Logcat. In your phone, just enable
Menu->Setting->Application->Development->Usb debugging
From your windows/linuxmac console
adb devices
adb -s device_serial logcat
There are your log.
Windows --> Open Perspective -->other -->DDMS-->OK (Select your Device)
And for USB Debugging in device
Menu-->Setting->Application-->Development-->Usb Debugging
You can also look up an app on the market named alogcat. Search for your app with that app (Menu>Search).
To get the crash logs use the Android Debug Bridge.
Related
I've recenlty buyed the Xiaomi Redmi 3 for Android development but I have the following issue. The USB debugging is turned on, the ADB is connected. But when I try to install the APK file by typing the
adb install my.apk
I receive the following message:
/system/bin/pm[6]: app_process: not found
And nothing happens. When I try to install it from Android Studio it shows just like it running the app, but nothing is happening. Maybe someone have experience with dealing with that?
I fixed that by rooting the device. Don't know why it helps but I got it working.
Instead of rooting it, try this:
Go to Settings --> Additional Settings --> Privacy
Enable "Unknown Sources (Allow installation of apps from unknown sources)" option
Then try installing it. It should work.
Is the app listed as installed on your phone?
If it is, try uninstalling it and running install command again.
I am trying to debug my android application using log messages. When I use System.out.println and Log.i and run the android application,I cannot see the debug message in either console or Logcat. If I have to get the debug messages do I have to run the android app in debug mode
from eclipse goto window -> open perspective -> other -> select DDMS.
And then run your app. And then select your running device from DDMS.
If it is not resolved your problem, restart your eclipse without closing your emulator and then flow the same above steps.
Njoy,
You do not need to run your app in debug mode to see log messages.
In order to see the log messages, you only need to have usb debugging enabled on your phone, the adb drivers for your device installed, and a copy of the android developer tools. It sounds like you have the above things, so I will suggest some steps for troubleshooting this.
Don't use System.out.println, because it does not allow you to specify a tag. Make sure that you set a good tag for your log messages. Once all of the above is confirmed, attempt to view the log message in eclipse's logcat view. Create a filter with the tag you are using because many messages will print and it may be difficult to find yours. You can also filter by application by using the name of your application's package.
If you have tried all this and you still can't see log messages, try running:
adb kill-server
and
adb start-server
If no luck, try restarting eclipse.
Confirm your device is plugged in!
If none of this is working, you can also run ddms from the sdk tools which is a bit more reliable.
Finally if that doesn't work, you can simply issue an adb logcat on the command line. If you have multiple devices, you can list them with adb devices and resolve the device or emulator with -d for the only connected device, -e for the emulator, or -s serialno to resolve otherwise.
There are also tools that will allow you to view the logs on your device, such as alogcat
sometime you may not select the emulator
and another way is to
restart your eclipse i also have faced this problem many times
If you're using Eclipse make sure that:
You have Debugging enabled in your device (or that you use emulator),
Your device is connected properly - it should show up in the Devices view. If you don't have this view get it from Window->Show View->Devices,
You've SELECTED your device in the Device View (simply click on it),
You don't have the LogCat paused and no filter is enabled - All messages (no filters).
i am using my samsung galaxy3 device for testing my apps from last two months. It is working fine.
But suddenly from this morning when i connected my device to my system it is not showing up in the "Android Device chooser" window.
I have checked, USB debug mode is in checked state only in my device.
Can anybody guess the problem. It is little urgent.
Thanks,
Nehatha
Use a shell of some sort (Run -> cmd) and browse to the /platform-tools/ directory inside the place you installed the Android SDK Tools.
Shut down Eclipse, unplug your device and try running:
adb kill-server
adb start-server
Plug it back in and run
adb devices
If you can see it, good. Now run:
adb logcat -c
adb logcat
This will flush the current logcat output and then show the logcat output in the shell as it updates (do something on the device and the log will update). Stop it with Ctrl-C and restart Eclipse.
This has helped for me sometimes.
Also, rebooting helps.
I have another similar issue over here which I haven't found an answer to yet: Device going offline randomly (and appearing multiple times as offline) in Eclipse - fixes?
Hope some of it helps.
I have the same problem and I figured out the solution for me.
On the home screen of your device choose Menu > Settings > Applications > Development.
Make sure that ‘USB debugging’ is checked.
Hope it will help someone :)
close the emulator then restart eclipse.
Finally my device is working after "Factory data Reset".
Thanks you all for your suggestions, even those suggestions not worked for me, I came to know about other useful.
Thank You.
I had similar issue, what worked for me was switching to "connected as camera" mode instead of "connected as media device" from the USB options menu, then performing Klaus's solution (kill server, start server).
I am no good with hardware concepts. So I have this probably very silly doubt.
I want to add Log to my application. When running on an emulator, I know where to see the Log output - it's visible in the Logcat window of Eclipse.
I want to know where I can see these logs when I run it on a hardware device. I am using following command to load my app on to the device : ./adb install helloWorld.apk
So where will the log be created and under what name?
Apologies if the question is vague or silly. I really do not know more details.
-Kiki
Try to use:
./adb logcat
When you run on device, the log is also available in LogCat. You will need to turn on USB debugging (Settings > Applications > Development > USB Debugging) in your device, then you can use LogCat just like in the emulator, both using ./adb logcat and in Eclipse.
This is pretty simple: I'm using NetBeans on Linux with Android emulator 1.6. I have Logcat on my android phone, but the process of getting the messages to somewhere readable isn't smooth at all.
Can someone tell me how to get Logcat running on the emulator? Is there anything I can do to see debug messages other then having to copy the apk to my phone and testing it?
Thanks in advance!
You have a few options for viewing the debug log output, assuming you have the SDK installed and your command path set up correctly:
Type adb logcat. The log output from the connected device or running emulator will appear. I usually prefer adb logcat -v time to see the time stamps.
Type ddms. This launches the stand-alone version of DDMS. It has a logcat display at the bottom.
Install the ADT extension for Eclipse, and open the logcat view. (Since you're using NetBeans I assume this isn't what you want to do, but I'm mentioning it for completeness.)
In all cases, the interaction is the same whether you're using a physical device or software emulator, because the ADB daemon conceals the details. Whatever you're doing for the device is also expected to work for the emulator.
If you have a device and emulator connected simultaneously, you can use adb -e logcat for the emulator and adb -d logcat for the device. From stand-alone DDMS or Eclipse, just pick the device or emulator from the pop-up menu.
If you have setup nbandroid you can find the adb logcat viewer in netbeans under:
Window -> Output -> ADB Log
--edit
Just followed up on the post above and started using C:\Program Files (x86)\Android\android-sdk-windows\tools\ddms which is alot better then the one in netbeans.
The SDK comes with a handy tool called ddms it should be in the tools folder of the SDK.
At the moment an Emulator is running, or a mobile phone is connected to your machine it should show up in ddms and you can see all the log output in ddms.