我最近更新了我的Android Studio,从那时起我的项目没有构建......我收到错误,如下面的错误:
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException:
class name (org/pervasivesystems/mobilehealth/activities/AppSettingsActivity$AppSettingsFragment)
does not match path
(org/pervasivesystems/mobilehealth/Activities/AppSettingsActivity$AppSettingsFragment.class)
我有很多这些错误......我猜这与大写字母有关?我想知道任何可能解决这种错误的方法。
这是其中一个例外的完整错误报告:
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: class name (org/pervasivesystems/mobilehealth/activities/AppSettingsActivity$AppSettingsFragment) does not match path (org/pervasivesystems/mobilehealth/Activities/AppSettingsActivity$AppSettingsFragment.class)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:520)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:665)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:170)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
...while parsing org/pervasivesystems/mobilehealth/Activities/AppSettingsActivity$AppSettingsFragment.class
每次Android Studio更新都会影响我的项目,我需要花费大量时间来转换项目以与新版本兼容!
答案 0 :(得分:62)
我可以通过点击工具栏项目Build --> Clean Project
来解决此问题。这固定的事情很好。
答案 1 :(得分:5)
您的目录名称必须与完全匹配清单中声明的包的名称。所以如果你有:
com / SomeDirectory / package然后清单中的包必须是: 包= “com.SomeDirectory.package”
在您的情况下,您似乎称之为“活动”和其他“活动”。
答案 2 :(得分:2)
我遇到了同样的问题。有趣的是,像这样的小事可以阻止你构建你的应用程序。我身边的问题出在AndroidManifest.xml文件中:
sleep_for
而不是" silviu.mypack"我有" silviu.mypackage"。我之前做过重构,这并没有改变。
祝大家好运!
答案 3 :(得分:1)
在我的例子中,我有一个名为gcc
的枚举和一个名为CODES
的内部类。显然这会带来麻烦。由于Codes
是Codes
的替代品,因此我可以通过删除对枚举的所有剩余引用来轻松修复它,最后删除仅包含 thing 调用代码的枚举我的班级。