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<<<
Najib Raihan is correct: The first thing to check is the android version on your device, vs. your emulator(s).
Even if the versions match, it's entirely possible for one to appear to "work", and the other to "crash". Just because one or the other doesn't "crash", doesn't mean your code is "correct". You DEFINITELY need to pay close attention to the warnings Android Studio gives you when you compile your app.
I don't see any "fatal errors" in the logcat you've shown: you need to look closer. In particular, the "Unknown bits set in runtime_flags: 0x8000" error is NOT the reason your app is crashing. Look here: "Unknown bits set in runtime_flags: 0x8000" warning in Logcat on Android Q emulator
EDUCATED GUESS:
I suspect your device might be running a newer version of Android, with additional "security restrictions". This can sometimes cause the app to terminate - sometimes even terminate without a clear logcat message.
SUGGESTION:
PLAN A:
Plug the failing device in to your USB port (as you're doing), make sure Logcat is running in A/S BEFORE you start your app, and hit "Debug" (not "Run", as I believe you're probably already doing). Look for "fatal errors" in LogCat and/or the A/S debugger.
PLAN B:
If it still slips by without giving you a decent error message, then set breakpoints in your app (starting with the very first display on your very first screen) and "divide and conquer" until you find the point of failure.