简体   繁体   中英

Android Studio: Can't find class after refactoring it into a package: Didn't find class "package.VideoPlayerFragment" on path: DexPathList

My classes were getting too messy with everything being in one package, so I create seperate packages for fragments, activities, services, etc.. and moved the respective classes to the new packages. Now, when I run the application, it crashes. In the error, it's saying it can't find the fragment VideoPlayerFragment:

Caused by: java.lang.ClassNotFoundException: Didn't find class "mypackage.VideoPlayerFragment" on path: DexPathList[[zip file "/data/app/mypackage-ZtBOtHSaSvbICeciH5XL0A==/base.apk"],nativeLibraryDirectories=[/data/app/mypackage-ZtBOtHSaSvbICeciH5XL0A==/lib/x86, /data/app/mypackage-ZtBOtHSaSvbICeciH5XL0A==/base.apk!/lib/x86, /system/lib]]

In the error it still says the old package name. The new one would be mypackage.fragments.VideoPlayerFragments. I don't know what to do... I already used "Clean Project" and I also tried deleting the .gradle folder but it still happens

As usual, immediately after posting here, I find the issue. There was a usage of this class in a layout xml file that did not get renamed by Android Studio and was still using the old package name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM