Andrew Fletcher published: 8 September 2023 (updated) 9 September 2023 1 minute read
Updating the Android app and while testing I'm seeing the following error in the AndroidManifest.xml file
Class referenced in the manifest, `com.{app_name}.app.MainActivity`, was not found in the project or the libraries
And the accompanying error
Unresolved class 'MainActivity'
Working through the suggestions
-
Invalidate caches
To invalidate the caches do the following
File > Invalidate caches / restart
Outcome: error remained
2. Restart Android Studio
Another suggestion was to restart Android Studio. Technically invalidating the caches incorporates a restart. But following process, I'll test. Expecting no change.
Outcome: error remained
3. Deleting the android directory
Time to delete the android directory and rebuild it.
Begin by deleting the current android directory.
rm -rf android
Add the Android platform.
npx cap add android
Now rebuild the Android code base
npm run build && npx cap sync && npx cap copy android && npx cap open android
Or you can read more details from - Launching app code in a simulator like Xcode or Android Studio
Related articles
Andrew Fletcher
•
29 Sep 2024
Managing app versioning in Android Studio - simplifying versionCode, versionName, and versionNameSuffix
Versioning is an important aspect of any mobile app development process. In Android, this is handled through versionCode and versionName, which allow you to define the current state of your app for users and the Play Store. But where exactly should these be managed, and how can you ensure they...
Andrew Fletcher
•
31 Oct 2023
Android icon not changing
If the Android app icon is not changing from the default icon (in my situation this was the Capacitor icon), here are some steps to troubleshoot and resolve the issue: Check the Icon FilesEnsure that you have provided the correct icon files in the appropriate directory. In a Capacitor project,...
Andrew Fletcher
•
27 Oct 2023
Working through android.permission.REQUEST_INSTALL_PACKAGES blocking releases
I'm receiving an issue with a previous release on Google Playandroid.permission.REQUEST_INSTALL_PACKAGESI'm seeing the following message in Google PlayRequest install packages permission
error - Not started - Your app isn't compliant
A permission that allows your app to install packages. If your...