'App runs smoothly on emulators but crashes on real device
I am beginner to android studio, currently i am working on an Video calling app. My app runs smoothly on multiple emulators in android studio but when i try to run it on real device (Oppo f9 pro) through USB Debugging, the app get installs but crashes immediately.
There are several errors in logcat. I searched about every error on google but didn't found any solution. The following are errors in logcat.
2021-12-14 20:23:12.541 2314-2314/? E/com.ahmad.nexo: Unknown bits set in runtime_flags: 0x8000
2021-12-14 20:23:14.998 2314-2314/com.ahmad.nexon E/ANR_LOG: >>> msg's executing time is too long
2021-12-14 20:23:14.998 2314-2314/com.ahmad.nexon E/ANR_LOG: Blocked msg = { when=-2s417ms what=110 target=android.app.ActivityThread$H obj=AppBindData{appInfo=ApplicationInfo{cc71d2b com.ahmad.nexon}} } , cost = 2390 ms
2021-12-14 20:23:14.998 2314-2314/com.ahmad.nexon E/ANR_LOG: >>>Current msg List is:
2021-12-14 20:23:14.998 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <1> = { when=-2s413ms what=159 target=android.app.ActivityThread$H obj=ClientTransaction hashCode, mActivityToken = android.os.BinderProxy@5ecb588 }
2021-12-14 20:23:14.998 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <2> = { when=-2s411ms what=159 target=android.app.ActivityThread$H obj=ClientTransaction hashCode, mActivityToken = android.os.BinderProxy@5ecb588 }
2021-12-14 20:23:14.998 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <3> = { when=-2s396ms what=159 target=android.app.ActivityThread$H obj=ClientTransaction hashCode, mActivityToken = android.os.BinderProxy@5ecb588 }
2021-12-14 20:23:14.999 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <4> = { when=-2s394ms what=159 target=android.app.ActivityThread$H obj=ClientTransaction hashCode, mActivityToken = android.os.BinderProxy@5ecb588 }
2021-12-14 20:23:14.999 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <5> = { when=-2s392ms what=9999 target=android.app.ActivityThread$H }
2021-12-14 20:23:14.999 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <6> = { when=-2s353ms what=149 target=android.app.ActivityThread$H obj=android.os.BinderProxy@5ecb588 }
2021-12-14 20:23:14.999 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <7> = { when=-2s348ms what=0 target=android.app.ActivityThread$H callback=com.android.internal.util.function.pooled.PooledLambdaImpl }
2021-12-14 20:23:14.999 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <8> = { when=-1s886ms what=159 target=android.app.ActivityThread$H obj=ClientTransaction hashCode, mActivityToken = android.os.BinderProxy@5ecb588 }
2021-12-14 20:23:14.999 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <9> = { when=-1s886ms what=137 target=android.app.ActivityThread$H arg1=1 obj=android.os.BinderProxy@5ecb588 }
2021-12-14 20:23:14.999 2314-2314/com.ahmad.nexon E/ANR_LOG: Current msg <10> = { when=+980ms what=131 target=android.app.ActivityThread$H obj=android.app.ActivityThread$ProviderRefCount@448eb21 }
2021-12-14 20:23:15.000 2314-2314/com.ahmad.nexon E/ANR_LOG: >>>CURRENT MSG DUMP OVER<<<
Solution 1:[1]
There are many situations that can cause a crash in your app. Some reasons are obvious, like checking for a null value or empty string, but others are more subtle, like passing invalid arguments to an API or even complex multithreaded interactions. Check This Link
Solution 2:[2]
The problem was with angle attribute. For example if you use angle of 112 or 100 or 130 etc that will crash your app. Always use angle dividable on 45 for example android:angle="90" android:angle="180" etc.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Najib Raihan |
| Solution 2 | Ahmad Yousafzai |
