androiddirectoryandroid-jetpack-compose

Res Directories unable to found the resources in Jetpack Compose Project?


In some files when I write R.drawable. then it's Showing all the resources that I added in drawable folder. But in some files it didn't show the drawable resources. This same happens not only with the drawable folder, but with the res folder in genereal. Anything that I add in res directories is not showing up.

The problem seems to be that the R class is not finding the resources directory.

My code looks as follows:


    val preloaderLottieComposition by rememberLottieComposition(
        spec = LottieCompositionSpec.RawRes(
            resId = R.raw.my_lottie_anim // But it didn't showing "my_lottie_anim" its says this Resource not found
        )
    )

I am using Android Studio Version Koala.

Code Looks Like, Image link


Solution

  • I found the Solution I write this :- com.emaple.myApp. com.example.myApp.R.raw.my_lottie_anim.

    But I don't Know Why it wasn't Showing the R class in Suggestions When I write com.emaple.myApp.

    val preloaderLottieComposition by rememberLottieComposition(
            spec = LottieCompositionSpec.RawRes(
                resId = com.example.myApp.R.raw.my_lottie_anim
            )
        )
    
    

    It wasn't Showing the R class in Suggestions that's Why I thought the R class not Exist Under the com.example.myApp.

    Thank God, Now I am able to Use the resources of Res Directories.