I forked one of my old projects, so I refactored the package name in the Android manifest XML. The actual package name and all the references in JAVA are renamed properly. However, when I run I get the following error message:
Error type 3
Error: Activity class
{my.old.package/my.new.package.gui.activities.LightSettingsActivity}
does not exist.
Apparently, the old package name is somewhere in configuration files where it does not belong I think.
Does someone know how to fix this?
By default, Android Studio builds the debug version of your app, which is intended for use only during development, when you click Run. To change the build variant Android Studio uses, select Build > Select Build Variant in the menu bar.
Step by Step Implementation Step 2: Now click on the setting gear icon and deselect Compact Middle Packages. Step 3: Now the packages folder is broken into parts as shown in the below image. Step 4: Now right-click on the first package name (com) and Refactor > Rename.
From the context menu, choose Refactor. From the submenu, choose Rename (or use the shortcut Shift + F6). Now, you can rename your method or member in place and apply the changes by hitting the Enter button. Android Studio provides you with some suggestions that you can accept or you can type the name you want.
I have had a similar issue. If you go to Build -> Clean Project, everything should work for you.
To quote a comment on my question:
It's not a bug. The Build Tool doesn't recognize the package name change and reuses the cache. "Clean Project" forces to rebuild all the classes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With