Unexpected top-level exception after changing package name
Asked Answered
S

1

1

I am working on an Android Studio project and ran into a problem when I tried to create a package that started with a capital letter (I forgot what it was at this point, but that's not the issue at hand). So I changed the package name from Adapters to adapters and now I can no longer compile.

I receive the following error message:

com.android.dx.cf.iface.ParseException: class name (com/example/android/myAppName/adapters/AccountAdapter$ViewHolder) does not match path (com/example/android/myAppName/Adapters/AccountAdapter$ViewHolder.class)

How can I change it so that it no longer tries to match the path with the capital A?

Semitrailer answered 18/12, 2014 at 0:26 Comment(6)
Tried "Clean Project"?Morphine
@Morphine oh my god I feel like the dumbest programmer in the world right now. I'm up and running again, that fixed the issue.Semitrailer
@Morphine any idea what causes that though? Is it a bug in Android Studio, since the refactoring of the package name didn't work?Semitrailer
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.Morphine
That makes a lot of sense. Thanks so much for the insight.Semitrailer
No problem. "Clean Project" is a solution to most Build errors! :)Morphine
S
4

This issue has been resolved. Thanks to aid of a commenter, I no longer received this exception after running "Clean Project" in Android Studio.

See the comments to the question for more explanation on why this happened.

Semitrailer answered 18/12, 2014 at 0:32 Comment(1)
same to me, renamed package and got this error, clean project halpedImpartible

© 2022 - 2025 — McMap. All rights reserved.