log_snippet:
W/System: ClassLoader referenced unknown path: /data/app/~~abc==/com.example.app-123/lib/arm64
E/UnsatisfiedLinkError: dlopen failed: library "libnative.so" not found
  at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
  at java.lang.System.loadLibrary(System.java:1660)
  at com.example.app.NativeLib.<clinit>(NativeLib.java:10)

diagnosis: UnsatisfiedLinkError: Native library libnative.so not found in APK

root_cause: Native .so files not packaged (missing jniLibs/src/main/jniLibs), ABI mismatch, or strip debug symbols removed them

prevention: Place .so files in src/main/jniLibs/{arm64-v8a,armeabi-v7a,x86,x86_64}/; check build.gradle ndk.abiFilters

split: train


log_snippet:
E/DatabaseUtils: Writing exception to parcel
  java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/contacts from pid=12345, uid=10156 requires android.permission.READ_CONTACTS
    at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:730)
    at android.content.ContentProvider$Transport.query(ContentProvider.java:280)
    at android.content.ContentResolver.query(ContentResolver.java:900)
    at com.example.app.ContactManager.loadContacts(ContactManager.java:33)

diagnosis: SecurityException: App queries ContactsProvider without READ_CONTACTS permission

root_cause: Runtime permission not granted; need to request READ_CONTACTS at runtime (API 23+)

fix_commands: adb shell pm grant com.example.app android.permission.READ_CONTACTS

fix_commands: adb shell am start -n com.example.app/.MainActivity

prevention: Request runtime permissions before accessing contacts; handle permission denial gracefully


log_snippet:
E/Resources: Resource ID #0x7f080001 type #0x12 is not valid
E/AndroidRuntime: FATAL EXCEPTION: main
  android.content.res.Resources$NotFoundException: Resource ID #0x7f080001
    at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:230)
    at android.content.res.Resources.getString(Resources.java:1300)
    at com.example.app.MainActivity.onCreate(MainActivity.java:20)

diagnosis: Resources$NotFoundException: String resource ID not found (likely stripped by R8/ProGuard)

root_cause: R8 removed unused resource but code references it via dynamic ID; or wrong resource type (string vs drawable)

fix_commands:
adb shell pm clear com.example.app
adb install -r r8-fixed.apk

prevention: Add @Keep to resources; use R.string.xxx not raw IDs; check proguard-rules.pro for -keepclassmembers


log_snippet:
E/ActivityManager: Process com.example.app (pid 12345) has died: TOP (1,0)
W/ActivityManager: Force removing ActivityRecord{... com.example.app/.MainActivity}: app died, no saved state
I/WindowManager: WIN DEATH: Window{... com.example.app/com.example.app.MainActivity}
E/lowmemorykiller: Kill 'com.example.app' (12345), adj 0, size 150MB, to free 120MB for 'com.other.app' (345)

diagnosis: Process killed by lowmemorykiller (OOM killer) - system reclaiming memory

root_cause: App using 150MB+ memory; system under memory pressure; no onTrimMemory() handling

fix_commands: adb shell dumpsys meminfo com.example.app

prevention: Implement onTrimMemory(); use LruCache for bitmaps; reduce memory footprint; use isLowRamDevice() checks


log_snippet:
E/HAL: load: id=gralloc != hmi->id=gralloc
E/GraphicBuffer: createGraphicBuffer: failed to allocate buffer (Out of memory)
E/Surface: queueBuffer: error queuing buffer to SurfaceTexture: -12
E/EGL_emulation: tid 12345: eglCreateWindowSurface:1000: failed with EGL_BAD_ALLOC
  at android.view.HardwareRenderer$GlRenderer.createSurface(HardwareRenderer.java:1800)

diagnosis: EGL_BAD_ALLOC / Out of memory allocating GraphicBuffer - GPU memory exhaustion

root_cause: Too many large bitmaps, memory leak in custom View, or hardware acceleration issues with large textures

fix_commands: adb shell setprop debug.hwui.use_buffer_age false

prevention: Recycle bitmaps; use inBitmap; reduce texture sizes; avoid hardware layers on large views; check for canvas leaks


log_snippet:
E/WindowManager: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
  at android.view.ViewRootImpl.setView(ViewRootImpl.java:800)
  at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:370)
  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:100)
  at android.app.Dialog.show(Dialog.java:420)
  at com.example.app.util.ToastUtil.showCustomToast(ToastUtil.java:20)

diagnosis: BadTokenException: Trying to show Dialog/Window with null Context token (likely from non-Activity Context)

root_cause: Using Application Context or Service Context to show Dialog; Dialog requires Activity Context

fix_commands:
adb shell am force-stop com.example.app
adb install -r fixed-context.apk

prevention: Pass Activity context to Dialog; use Toast for non-Activity contexts; check context instanceof Activity


log_snippet:
E/Parcel: Class not found when unmarshalling: com.example.app.model.User
  java.lang.ClassNotFoundException: com.example.app.model.User
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:453)
    at android.os.Parcel.readParcelableCreator(Parcel.java:2820)
    at android.os.Parcel.readParcelable(Parcel.java:2776)
    at com.example.app.MainActivity.onCreate(MainActivity.java:28)

diagnosis: ClassNotFoundException when unmarshalling Parcelable - class not found in classloader

root_cause: ProGuard/R8 obfuscation removed/renamed Parcelable class; or multi-process IPC with different classloader

fix_commands:
adb shell pm clear com.example.app
adb install -r proguard-fixed.apk

prevention: Add @Keep annotation or proguard rule: -keep class com.example.app.model.** { *; }; implement Parcelable correctly


log_snippet:
E/BluetoothAdapter: Bluetooth adapter not found
W/BluetoothManager: getAdapter() returning null - device may not support Bluetooth
E/BluetoothLeScanner: Could not start scan - BluetoothAdapter is null
  at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:400)
  at com.example.app.BleScanner.startScan(BleScanner.java:28)

diagnosis: BluetoothAdapter is null - device lacks Bluetooth hardware or permission missing

root_cause: No <uses-feature android:name="android.hardware.bluetooth_le" /> or BLUETOOTH_SCAN permission (Android 12+)

fix_commands: adb shell pm grant com.example.app android.permission.BLUETOOTH_SCAN

fix_commands: adb shell pm grant com.example.app android.permission.BLUETOOTH_CONNECT

prevention: Add bluetooth permissions and feature flags; check BluetoothAdapter.getDefaultAdapter() != null before use


log_snippet:
E/ActivityManager: ANR in com.example.app
  PID: 12345
  Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing input events)
  Load: 4.2 / 3.8 / 3.5
  CPU usage from 0ms to 5000ms later:
    85% 12345/com.example.app: 78% user + 7% kernel
    5% 345/system_server
  Stack trace:
    at com.example.app.DataProcessor.processLargeDataset(DataProcessor.java:120)
    at com.example.app.MainActivity$1.onClick(MainActivity.java:88)

diagnosis: ANR (Application Not Responding) - main thread blocked for >5 seconds processing large dataset on click

root_cause: Heavy computation (DataProcessor.processLargeDataset) running on UI thread in onClick handler

fix_commands:
adb shell am force-stop com.example.app
adb shell kill -3 12345
adb install -r fixed-app.apk

prevention: Move heavy work to background thread (coroutines, RxJava, AsyncTask, Thread); show progress indicator


log_snippet:
E/AndroidRuntime: FATAL EXCEPTION: main
  java.lang.IllegalStateException: FragmentManager is already executing transactions
    at androidx.fragment.app.FragmentManager.ensureExecReady(FragmentManager.java:1800)
    at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1812)
    at androidx.fragment.app.BackStackRecord.commitNow(BackStackRecord.java:300)
    at com.example.app.MainActivity.replaceFragment(MainActivity.java:55)

diagnosis: IllegalStateException: FragmentManager transaction committed during another transaction

root_cause: commitNow() called while FragmentManager already executing transactions (e.g., in onAttach/onCreate)

fix_commands:
adb shell am force-stop com.example.app
adb install -r fixed-app.apk

prevention: Use commit() instead of commitNow(); avoid fragment transactions in onAttach/onCreate; use postOnViewCreated()


log_snippet:
E/SQLiteLog: (1) table users has no column named email
E/SQLiteDatabase: Error inserting name=John email=john@example.com
  android.database.sqlite.SQLiteException: table users has no column named email (code 1 SQLITE_ERROR)
    at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
    at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:879)
    at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
    at com.example.app.db.UserDao.insert(UserDao.java:30)

diagnosis: SQLiteException: table missing 'email' column - schema mismatch

root_cause: Database schema changed but onUpgrade() not implemented or version not incremented

fix_commands:
adb shell pm clear com.example.app
adb install -r migrated-db.apk

prevention: Implement SQLiteOpenHelper.onUpgrade() with ALTER TABLE; increment DATABASE_VERSION; use Room with migrations


log_snippet:
W/Choreographer: Skipped 124 frames! The application may be doing too much work on its main thread.
I/Choreographer: Skipped 67 frames! The application may be doing too much work on its main thread.
E/PerfMonitor: App com.example.app jank stats: 45% frames > 16ms, 12% frames > 100ms

diagnosis: UI jank - main thread overloaded causing frame drops (124+ skipped frames)

root_cause: Heavy computation, layout passes, or I/O on main thread; RecyclerView binding too complex

fix_commands: adb shell dumpsys gfxinfo com.example.app framestats

fix_commands: adb shell am profile start com.example.app /sdcard/trace.perf

fix_commands: adb shell am profile stop com.example.app

prevention: Move work to background; use DiffUtil for RecyclerView; optimize layouts; enable hardware acceleration


log_snippet:
E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.example.app, PID: 12345
  java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
    at com.example.app.MainActivity.onCreate(MainActivity.java:42)
    at android.app.Activity.performCreate(Activity.java:8000)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)

diagnosis: NullPointerException in MainActivity.onCreate at line 42 - TextView not initialized before setText()

root_cause: findViewById() returned null, likely wrong resource ID or view not yet inflated when setText() called

fix_commands:
adb shell am force-stop com.example.app
adb shell pm clear com.example.app
adb install -r fixed-app.apk

prevention: Use ViewBinding or add null check: TextView tv = findViewById(R.id.text); if (tv != null) tv.setText("text");


log_snippet:
E/ConnectivityManager: Network callback not registered
W/System.err: java.net.UnknownHostException: Unable to resolve host "api.example.com": No address associated with hostname
    at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:127)
    at java.net.Inet6AddressImpl.lookupAllHostByName(Inet6AddressImpl.java:105)
    at java.net.InetAddress.getAllByName(InetAddress.java:1154)
    at com.example.app.NetworkClient.fetchData(NetworkClient.java:56)

diagnosis: UnknownHostException - DNS resolution failed for api.example.com

root_cause: No network connectivity, DNS server issue, or missing INTERNET permission

fix_commands: adb shell pm grant com.example.app android.permission.INTERNET

fix_commands: adb shell settings put global http_proxy :0

fix_commands: adb shell am start -a android.settings.WIRELESS_SETTINGS

prevention: Check connectivity before network calls; handle UnknownHostException; add INTERNET permission to manifest


log_snippet:
E/AndroidRuntime: FATAL EXCEPTION: main
  java.lang.ClassCastException: androidx.appcompat.widget.AppCompatTextView cannot be cast to android.widget.EditText
    at com.example.app.LoginActivity.onCreate(LoginActivity.java:35)
    at android.app.Activity.performCreate(Activity.java:8000)

diagnosis: ClassCastException: View with ID R.id.email is TextView in layout but cast to EditText in code

root_cause: Layout XML has TextView but code expects EditText; mismatch after layout refactor

fix_commands:
adb shell am force-stop com.example.app
adb install -r fixed-layout.apk

prevention: Use ViewBinding to eliminate casting; verify layout XML matches code expectations


log_snippet:
W/PackageManager: Package com.example.app requesting special permission android.permission.SCHEDULE_EXACT_ALARM but not in allowlist
E/AndroidRuntime: FATAL EXCEPTION: main
  java.lang.SecurityException: Exact alarms permission not granted
    at android.app.AlarmManager.setExactAndAllowWhileIdle(AlarmManager.java:1200)
    at com.example.app.ReminderScheduler.schedule(ReminderScheduler.java:22)

diagnosis: SecurityException: SCHEDULE_EXACT_ALARM permission not granted (Android 12+)

root_cause: App uses setExactAndAllowWhileIdle() but user hasn't granted 'Alarms & reminders' special permission

fix_commands: adb shell am start -a android.settings.REQUEST_SCHEDULE_EXACT_ALARM -d package:com.example.app

fix_commands: adb shell appops set com.example.app SCHEDULE_EXACT_ALARM allow

prevention: Request SCHEDULE_EXACT_ALARM via Settings intent; fallback to inexact alarms; use WorkManager for deferrable work


log_snippet:
W/BatteryStatsImpl: Couldn't get kernel wake lock stats
W/PowerManagerService: WakeLock acquire timeout: uid=10156, tag=*location*
W/PowerManagerService: Excessive wake lock usage: uid=10156, count=47, time=3600000ms
E/BatteryExternalStatsWorker: High battery drain detected for com.example.app: 15% per hour

diagnosis: Excessive battery drain from location wake locks held for 1+ hour

root_cause: Location updates requested with high frequency/priority without proper cleanup; FusedLocationProviderClient not disconnected

fix_commands: adb shell cmd appops set com.example.app ACCESS_FINE_LOCATION ignore

prevention: Use setPriority(PRIORITY_BALANCED_POWER_ACCURACY); remove location updates in onStop/onDestroy; use WorkManager for periodic updates


log_snippet:
W/ZipArchive: Unable to open '/data/app/~~abc==/com.example.app-123/base.apk': No such file or directory
E/PackageManager: Package com.example.app not installed
E/ActivityThread: Failed to find provider info for com.example.app.provider
  at android.app.ActivityThread.installProvider(ActivityThread.java:7200)

diagnosis: Package not installed but provider queried - app data corrupted or incomplete install

root_cause: Partial install, storage full during install, or app moved to SD card that was removed

fix_commands:
adb uninstall com.example.app
adb install -r app.apk

prevention: Check install return code; don't move app to external storage if it has providers/services


log_snippet:
E/ActivityThread: Failed to find provider info for com.example.app.fileprovider
E/AndroidRuntime: FATAL EXCEPTION: main
  java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.example.app/files/image.jpg
    at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:740)
    at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:410)
    at com.example.app.ShareHelper.shareImage(ShareHelper.java:35)

diagnosis: FileProvider IllegalArgumentException: File not in configured <paths> root

root_cause: FileProvider XML paths missing <files-path> or wrong path; file outside declared directories

fix_commands:
adb shell pm clear com.example.app
adb install -r fixed-provider.apk

prevention: Ensure fileprovider_paths.xml includes <files-path name="files" path="files/"/>; use getFilesDir() not hardcoded paths