how can I solve “package R does not exist”

Here are some techniques which you can use to remove this error:

  1. Clean your project, Buidl->clean Project

  2. Rebuild project, Build -> Rebuild Project

  3. Open manifest and check is there any resource missing

  4. Check-in layout to particular id if missing add it

  5. If the above steps did not work then restart android studio with invalidating the cache

Also, ensure that your android_library/android_binary is using an AndroidManifest.xml with the correct package= attribute, and if you’re using the custom_package attribute on android_library or android_binary, ensure that it is spelt out correctly.

Also, make sure you have added correct package name on top of your java class.

Leave a Comment