Question

I'm trying to migrate a project over to Android Studio / Gradle but I'm having a bizarre problem with a jar that worked fine using Ant. It seems that R and BuildConfig are included in the jar, and their package name is declared as upper case where in reality the package structure has it defined as lower case. (I've changed the package name to protect the anonymity of the developer, hope that's ok)

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: class name (com/companyname/UI/BuildConfig) does not match path (com/companyname/ui/BuildConfig.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.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) 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 com/companyname/ui/BuildConfig.class

Here are my questions:

  • Why would it work with Ant and not Gradle?
  • Should this be considered a defect / bug or is it a design decision?
  • How come I can't find anyone else on the internet having this issue with other jars?
  • What advice can I give to the developer on how to correct the issue?
Was it helpful?

Solution

I think if you rebuild the library and exclude everything from the /gen directory, everything should work fine.

OTHER TIPS

This happened to me when the package name in Play (com.checkpoint.DocSec) was different from the local directory (com.checkpoint.docsec), and the file insensitivity of the local file system screwed up the building process.

According to this, I could change the package name in the manifest to com.checkpoint.capsule.docs (it doesn't really matter, as long as it's not the same, case-sensitive-wise), and set the application id in build.gradle to com.checkpoint.DocSec (very important to keep it exactly the same as it was!!!).

This solved the problem for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top