android-datepicker: UNEXPECTED TOP-LEVEL EXCEPTION

2019-02-25 14:34发布

问题:

I'm trying to include Simon's DatePicker lib project (https://github.com/SimonVT/android-datepicker) in my own project. The README file says it depends on both his NumberPicker and CalendarView lib projects. So I placed all three projects in my project dir, ran android update lib-project on them (I'm using ant), added the NumberPicker and CalendarView libs as dependencies of the DatePicker lib and the DatePicker lib as a dependency of my own project. Up until now all is well. It also compiles, so the dependencies seem to work. But when the dexing starts, I get the following error:

[dex] Converting compiled files and external libraries into /home/rogerrapid/MyProject/bin/classes.dex...
   [dx] 
   [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
   [dx] java.io.FileNotFoundException: /home/rogerrapid/MyProject/android-datepicker/library/bin/classes.jar (No such file or directory)
   [dx]     at java.util.zip.ZipFile.open(Native Method)
   [dx]     at java.util.zip.ZipFile.<init>(ZipFile.java:214)
   [dx]     at java.util.zip.ZipFile.<init>(ZipFile.java:144)
   [dx]     at java.util.zip.ZipFile.<init>(ZipFile.java:158)
   [dx]     at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:206)
   [dx]     at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
   [dx]     at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
   [dx]     at com.android.dx.command.dexer.Main.processOne(Main.java:422)
   [dx]     at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
   [dx]     at com.android.dx.command.dexer.Main.run(Main.java:209)
   [dx]     at com.android.dx.command.dexer.Main.main(Main.java:174)
   [dx]     at com.android.dx.command.Main.main(Main.java:91)
   [dx] 1 error; aborting

Does anyone know how to solve this? I guess I must be overlooking something. I've never tried adding an android library with other lib dependencies before.

回答1:

check in the project.properties from android-datepicker folder, if the project isn't mark as a library, use android.library=true to mark the project as library...