kotlin Errors
42 error patterns
Jetpack Compose vertical scroll with infinite constraints
Android.*Compose.*IllegalStateException.*Vertically scrollable.*was measured with.*infinite.*constraints
- •Don't nest vertically scrollable components (LazyColumn in Column with scroll)
- •Use height(IntrinsicSize.Min) or explicit height modifier
Android Hilt injection not performed
Android.*Hilt.*IllegalStateException.*has not been.*injected
- •Annotate Activity/Fragment with @AndroidEntryPoint
- •Ensure Application class has @HiltAndroidApp annotation
Android Room migration incomplete
Android.*Room.*IllegalStateException.*Migration.*didn't properly handle
- •Ensure migration SQL covers all schema changes between versions
- •Use autoMigrations in @Database annotation for simple changes
Android R8/ProGuard missing class after obfuscation
Android.*R8.*Warning.*Missing class.*referenced from
- •Add -keep rule in proguard-rules.pro for the missing class
- •Add -dontwarn for expected missing classes (e.g., optional dependencies)
Jetpack Compose CompositionLocal not provided
Android.*Compose.*java\.lang\.IllegalStateException.*CompositionLocal.*not.*present
- •Wrap composable tree with CompositionLocalProvider
- •Provide the CompositionLocal value above the composable that reads it
Android Hilt ViewModel missing @Inject constructor
Android.*Hilt.*Cannot create.*@HiltViewModel.*without.*@Inject
- •Add @Inject constructor() to the ViewModel class
- •Annotate ViewModel with @HiltViewModel
Android Room cursor window full (row too large)
Android.*Room.*Cursor.*window.*full.*row too large
- •Limit query result columns to only those needed
- •Store large BLOBs externally and keep references in Room
Android ProGuard can't find referenced constructor
Android.*ProGuard.*Warning.*can't find referenced method.*constructor
- •Add -keep class rule for the class with missing constructor
- •Use @Keep annotation on classes instantiated via reflection
Jetpack Compose LazyColumn duplicate key
Android.*Compose.*LazyColumn.*Key.*was already used
- •Ensure key parameter in items() produces unique values for each item
- •Use item.id or unique identifier as key, not index
Jetpack Compose unnecessary recomposition from unstable params
Android.*Compose.*recomposition.*skipped.*unstable.*parameter
- •Mark data classes as @Stable or @Immutable
- •Use remember{} to stabilize lambda parameters
Android Hilt missing binding for dependency
Android.*Hilt.*MissingBinding.*cannot be provided without an @Provides
- •Create @Module with @Provides function for the type
- •Or annotate the class with @Inject constructor for automatic binding
Android Room unsupported field type
Android.*Room.*error:.*Cannot figure out how to save this field into database
- •Add @TypeConverter for the unsupported type
- •Register TypeConverters in @Database(typeConverters = [...])
Android class not found after R8 minification
Android.*R8.*ClassNotFoundException.*after minification
- •Add -keep rule for classes used via reflection
- •Use @Keep annotation on the class
Jetpack Compose ClassCast in composable singletons
Android.*Compose.*ClassCastException.*ComposableSingletons
- •Clean and rebuild the project: ./gradlew clean assembleDebug
- •Check for Compose compiler version mismatch with Kotlin version
Android Hilt WorkManager Worker injection failure
Android.*Hilt.*InstantiationException.*WorkManager.*Worker.*Inject
- •Use @HiltWorker annotation on the Worker class
- •Add @AssistedInject constructor with @Assisted for context and workerParams
Android Room missing migration between versions
Android.*Room.*IllegalArgumentException.*Migration path.*NOT find migration
- •Add Migration(oldVersion, newVersion) to database builder
- •Use fallbackToDestructiveMigration() for development only
Android R8 method too large after optimization
Android.*ProGuard.*R8.*ClassFormatError.*Method.*too large
- •Split large methods into smaller ones
- •Disable specific R8 optimizations: -dontoptimize for problematic class
Jetpack Compose function called from non-composable context
Android.*Compose.*Error:.*@Composable.*invocations.*can only happen from.*@Composable
- •Annotate the calling function with @Composable
- •Move composable call inside a proper composable scope
Android Hilt EntryPoint usage error
Android.*Hilt.*EntryPoints.*cannot be used in.*@HiltAndroidApp
- •Use EntryPointAccessors.fromApplication(context, MyEntryPoint::class.java)
- •Ensure @EntryPoint interface is annotated with @InstallIn(SingletonComponent::class)
Android Room DAO method missing annotation
Android.*Room.*Dao.*abstract.*method.*not annotated with.*Query.*Insert.*Update.*Delete
- •Add @Query, @Insert, @Update, or @Delete annotation to DAO methods
- •Ensure method return type matches the annotation (Insert returns Long/void)
Android AbstractMethodError after R8 obfuscation
Android.*R8.*AbstractMethodError.*after obfuscation
- •Add -keep rules for interfaces implemented via generics
- •Use -keepclassmembers for overridden abstract methods
Jetpack Compose RecyclerView interop crash with LazyColumn
Android.*Compose.*SnapHelper.*crash.*RecyclerView.*LazyColumn.*interop
- •Use pure Compose LazyColumn instead of RecyclerView interop
- •If interop is needed, use AndroidView with proper lifecycle handling
Kotlin NullPointerException
kotlin\.KotlinNullPointerException|java\.lang\.NullPointerException.*Kotlin
- •Use safe call operator ?. instead of direct access
- •Add null check with let: value?.let { ... }
lateinit property accessed before initialization
lateinit property.*has not been initialized
- •Initialize the property before accessing it
- •Use ::property.isInitialized check before access
ClassCastException in Kotlin
java\.lang\.ClassCastException.*cannot be cast to
- •Use safe cast: value as? TargetType
- •Check type before cast: if (value is TargetType) { ... }
Activity not declared in AndroidManifest
Unable to find explicit activity class.*have you declared this activity in.*AndroidManifest
- •Add <activity android:name=".YourActivity"/> to AndroidManifest.xml
- •Verify the fully qualified class name matches the manifest entry
Gradle dependency resolution failed
Could not resolve.*com\.android|Failed to resolve.*gradle
- •Add google() and mavenCentral() to repositories block
- •Check the dependency coordinates for typos
Jetpack Compose infinite recomposition loop
Recomposition.*infinite|Too many recompositions
- •Move state changes out of the composable body into LaunchedEffect or event handlers
- •Use remember { } to prevent recreating objects on every recomposition
Accessing member before super constructor completes
Cannot access.*before supertype constructor has been called
- •Move the initialization to an init block after super constructor
- •Use lazy initialization for the property
UI update from wrong thread on Android
Only the original thread that created a view hierarchy can touch its views
- •Use runOnUiThread { } or view.post { } to update UI from background
- •Use withContext(Dispatchers.Main) in coroutines
ViewModel missing no-arg constructor
ViewModelProvider.*has no zero argument constructor
- •Create a ViewModelFactory to provide constructor arguments
- •Use Hilt @HiltViewModel + @Inject constructor for DI
Unresolved reference in Kotlin
Unresolved reference:.*
- •Import the missing class or function
- •Check that the dependency providing it is in build.gradle
Nullable type where non-null expected
Type mismatch.*Required:.*Found:.*\?
- •Use !! operator if you're certain it's non-null (risky)
- •Use safe call with let: value?.let { nonNull -> ... }
Suspend function called outside coroutine
Suspension functions can be called only within coroutine body
- •Launch a coroutine: lifecycleScope.launch { suspendFun() }
- •Use viewModelScope.launch in ViewModel
Fragment operation when not attached to Activity
java\.lang\.IllegalStateException.*Fragment.*not attached to
- •Check isAdded before accessing context or activity
- •Use viewLifecycleOwner.lifecycleScope for Fragment coroutines
Kotlin compiler type incompatibility
e: Incompatible types.*expected.*found
- •Add explicit type conversion: .toInt(), .toString(), etc.
- •Check generic type parameters for variance issues
Layout XML inflation error
Caused by:.*InflateException.*Binary XML
- •Check for missing custom view class in the XML layout
- •Verify all required attributes are present in the XML
KAPT annotation processing failed
Execution failed for task ':app:kaptDebug.*
- •Check error above for the actual annotation processor failure
- •Clean and rebuild: ./gradlew clean assembleDebug
Resource leak detected by StrictMode
StrictMode.*Leaked.*closable
- •Use .use { } block for Closeable resources (auto-closes)
- •Close cursors, streams, and connections in finally block
Invalid notification configuration
RemoteServiceException.*Bad notification
- •Ensure notification channel is created before posting (Android 8+)
- •Set a valid small icon with setSmallIcon()
Background service start not allowed (Android 12+)
BackgroundServiceStartNotAllowedException
- •Use setForeground() for WorkManager expedited work
- •Use ForegroundService with foregroundServiceType declared in manifest
OOM from bitmap allocation
java\.lang\.OutOfMemoryError.*Failed to allocate.*bitmap
- •Use image loading library (Coil/Glide) with automatic downsampling
- •Set inSampleSize in BitmapFactory.Options to load smaller images