View exceptions which had happened before connecting ADB - android

While I am test-driving my unpublished application on my physical device without connecting it to a computer, sometimes an exception happens and the application gets killed. Now, if I connect the device to my computer and launch Android Studio and connect the Android monitor, the logcat does not show the exception that happened before connecting the device, and the exception is not reproducible.
Is there any way to make the device keep logs so that I can check it later with Android Studio?

Check this out : https://github.com/gaozp/ErrorHandleDemo ;
or you can check out this : http://developer.android.com/reference/java/lang/Thread.UncaughtExceptionHandler.html;
BTW this means you should implement a handler to catch all exception that your app occurs . and when your app has hit a exception ,this handler will catch this ,and you can save it to a time-named log to record this exception.

Related

Android: Experiencing "silent" crash when opening Developer Options programmatically from application

I'm experiencing a "silent" crash when Attempting to open the Developer Options programmatically with
override fun openDevelopmentSettings() {
val intent = Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS) //Silent-crashes the app on my phone, but not emulator. What?
startActivity(intent)
}
Opening the About Phone Settings however works perfectly fine when replacing the above param with Settings.ACTION_DEVICE_INFO_SETTINGS
Setting Android Studio's Logcat panel to Error and No Filters produces the following, where the About Phone Settings produce no errors:
2021-04-12 20:43:03.576 1586-2265/? E/UserRestrictionsUtils: Unknown restriction queried by uid 1000 (com.android.providers.settings et al): null
2021-04-12 20:43:03.577 1586-2265/? E/UserRestrictionsUtils: Unknown restriction queried by uid 1000 (com.android.providers.settings et al): null
2021-04-12 20:43:03.592 15832-15832/? E/ndroid.setting: Can't find memory status under: /sys/block/zram0/
2021-04-12 20:43:03.641 674-9189/? E/libnos_datagram: can't send spi message: Try again
2021-04-12 20:43:03.662 674-9189/? E/libnos_datagram: can't send spi message: Try again
2021-04-12 20:43:03.745 15832-15832/? E/BtHDAudioCtr: Active device is null. To disable HD audio button
2021-04-12 20:43:03.854 15832-15832/? E/BtHDAudioCtr: Active device is null. To disable HD audio button
2021-04-12 20:43:03.864 15832-16203/? E/ndroid.setting: Can't find memory status under: /sys/block/zram0/
Please note that the Developer Options menu does open, just my application's process crashes upon opening. Clicking the back button from the Developer Options relaunches my app instead of resuming as the process is dead.
I have used another app that also programmatically opens the Developer Options and do not experience the crash.
I have tried both debug and release builds.
I have also tried wrapping the code in a try-catch block, but when debugging the catch block isn't hit.
I unfortunately don't have another physical device to test on, but an emulator of the same device and API level doesn't reproduce the crash. What's going on here? Is my Pixel 3 at Android 11 (RQ2A.210305.006) corrupted? Memory error? Any help is greatly appreciated, thanks.

"The application may be doing too much work on its main thread" only without video output connected

I'm having a strange issue when I run my application from Android Studio on my device. When the HDMI cable of my device (e.g. Odroid) is disconnected (no other video output connected), I found in Logcat this error "The application may be doing too much work on its main thread". When a monitor is plugged the error did not show anymore.
Do you think is something related to the code or just a random error not relevant?
PS I need to use my app without video output.
PPS The error appears only when the monitor is not plugged.
It seems that , there is some waiting mechanism in your code , So I suggest you to shift your code into AsyncTask so you will never encounter this error.
http://developer.android.com/reference/android/os/AsyncTask.html

Titanium - ProxyFactory: failed to find class for ti.modules.titanium.network.HTTPClientProxy

I have a Titanium Android application for iBeacons detections, the app runs on background service and when that detects an iBeacon the app makes a HTTP request using Titanium.Network.HTTPClient.
Sometimes the service stops and shows the dialog stopped Android message for my app. Checking the log from "adb logcat" i get this feedback:
I/TiAPI (29207): => fetchAdByBeacon
E/JNIUtil (29207): ProxyFactory: failed to find class for ti.modules.titanium.network.HTTPClientProxy
E/ProxyFactory(29207): No proxy info found for class.
F/libc (29207): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 29229 (KrollRuntimeThr)
I think it could be a problem on Titanium Proxy when this is trying to get a new HTTPClient native object, but my question is... Could i handle this Titanium exception and prevent the app closes?
I am seeing a similar problem. What I noticed is that the entire device (Nexus 7, Android 4.4.2) didn't have a network connection (i.e. I couldn't browse the Internet with the Chrome browser, even though I seemed to be be connected to my usual wireless network).
I don't know yet what might have caused the problem, but rebooting my device solved it for me. You might want to verify that you have network connectivity.

Android UsbManager.openDevice(Device device) throw an Exception "device does not exist or be restricted"

I use a thread to send data to my usb-device (not data-storage) and get the return-data from device.
It worked fine in the first 5 minute. Data in, data out. (I almost start to sing in the sixth minute.)
Then suddenly it lost the connection.
There are the logcat message:
java.lang.IllegalArgumentException: device /dev/bus/usb/001/002 does not exist or is restricted
at android.os.Parcel.readException(Parcel.java:1331)
at android.os.Parcel.readException(Parcel.java:1281)
at android.hardware.usb.IUsbManager$Stub$Proxy.openDevice(IUsbManager.java:340)
at android.hardware.usb.UsbManager.openDevice(UsbManager.java:255)
So, I check the code of UsbManager, trying to find out what is the IUsbManager...
Cool. An interface... and there is zero information about what it is. That is why I am here.
Has anyone with any clue???
The app should be listening to the UsbManager.ACTION_USB_DEVICE_ATTACHED and UsbManager.ACTION_USB_DEVICE_DETACHED Intents. It should attempt to open the device received from the attached intent.
The error usually happens when the app tries to re-open the connection to a UsbDevice. When the UsbDevice reconnects it is assigned a new hardware address (Old: /dev/bus/usb/001/002, New: /dev/bus/usb/001/003).

Does android mobile has any error log file to debug cause for auto switch off?

Sometimes we see the device restarts automatically, while few other times I had found it switching off after long time, even battery was not low.
So if we want to trace back of what actually has caused this, does we have any log file in device memory which has the cause of shutdown or restart ?
Like we get the dump for the other O.S. for any errors occured causing it to restart/shutdown in specific error log file. Similarly does android has such ?
It may be anywhere , even in internal memory, so with root privileges I can go into looking for it.
Any thoughts ? Thanks.
If you have installed Terminal on your phone just tupe in
su
logcat
If not enable DebbugingMode on your phone, connect it with your PC/Mac, open Eclipse and go to Debug.
There it will show the log of the phone.
I hope this helps.

Categories

Resources