0

I'm building a Quran app using Jetpack Compose in Kotlin. The app builds successfully and installs on a real Android device (Samsung S908E), but crashes instantly on launch.

Crash Log:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.warattil.quran.ui.components.AllSurahsScreen" on path: ...

But the class does exist:

The file is present under:

app/src/main/java/com/warattil/quran/ui/components/AllSurahsScreen.kt

Here’s the class definition:

package com.warattil.quran.ui.components

@Composable
fun AllSurahsScreen(surahs: List<Surah>) {
    // UI Code here...
}

It’s being used like this in MainActivity.kt:

import com.warattil.quran.ui.components.AllSurahsScreen

@Composable
fun MainNavigation(navController: NavHostController, surahs: List<Surah>) {
    NavHost(navController = navController, startDestination = "all_surahs") {
        composable("all_surahs") {
            AllSurahsScreen(surahs = surahs)
        }
    }
}

Other notes:

  • App runs fine on emulator, only crashes on real device
  • Using Jetpack Compose + Kotlin 1.9.10
  • Build is successful in Android Studio
  • AndroidManifest.xml has the correct package and launcher activity
  • No ProGuard/R8 obfuscation enabled (for now)

What I’ve tried:

  • Cleaned + rebuilt the project
  • Invalidated cache / restarted
  • Verified the package name and class path
  • Ensured no typos in imports or filenames
  • Checked logcat for other hints

Question:

Why is the app throwing a ClassNotFoundException for a valid class that compiles and builds fine? Is there something about Compose navigation or Gradle that might cause this?


Any help is appreciated!

2
  • 2
    composable is function, not a class, so it's not an issue of composable, can you post more detailed crash logs? Commented Jun 25 at 11:10
  • How are you navigating to this screen? Commented Jun 25 at 11:50

1 Answer 1

0

I do not know much in android programming... only that it is based on Linux.

Have you verified which provider is used on your side side and samsung's one, since Oracle became a bit nasty about the programming licence / SDK... there could be an issue there.

Which raises the question of credentials and authorization of using java classes in the IRL use.

Last time I programmed in Java was in... 2005 ;) but perhaps I am obsolete but

app/src/main/java/com/warattil/quran/ui/components/AllSurahsScreen.kt

does it point to the binary or the source ?

Sorry if I am raising more questions than answers them :)

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your input! The file path I shared points to the source, and the class is defined and compiles fine. The crash only happens at runtime on a physical device, and only for this specific Composable. It seems unrelated to SDK licensing or Java binaries. Still investigating the runtime behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.