0

I have a main project (mainapp) I am developing for Android under Eclipse. It uses the facebook-android-sdk library (fblib) which is a separate Eclipse project with it's project properties checked as "Library". Under the project properties > android section for mainapp, I have fblib added as a library. everything works fine.

I needed to create a new version of mainapp which uses different database files (assets subdirectory). To do this, I created a new Eclipse project (newapp) and setup mainapp as a library under project properties > android.

Everything was working fine until the latest ADT update. I am getting errors trying to build/run newapp (Conversion to Dalvik format failed with error 1). If I go to mainapp and uncheck "Library" from project properties > android, I can build mainapp as a regular application and it seems to work just fine.

I've searched for multiple jar files in project directories, updated proguard to 4.8beta, deleted/added jars to the build path, removed exports, added exports, deleted dependencies, added "lib" directories, cleaned, restarted, rebooted and pretty much anything else google would turn up, but to no avail.

It was all working fine with ADT 16 so I'm really confused here. Has adding a library project to an application, which also incorporates a library project, become somehow deprecated? I just can't seem to get this working.

wufoo
  • 13,571
  • 12
  • 53
  • 78
  • How are you referencing your resources? do you have custom views with attributes that are breaking? – JRaymond Apr 27 '12 at 20:18
  • Yes, some of the views are in mainapp and the fblib project has some of it's own layouts as well. I gave up on the .jar method a year or so ago because the res/ directory wasn't getting put into the jars. That's apparently done differently now. – wufoo Apr 27 '12 at 20:38

3 Answers3

1

The new ADT makes you call it 'libs' instead of lib. rename your directory and see if that fixes it

Refer: http://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=27490

JRaymond
  • 11,625
  • 5
  • 37
  • 40
  • I think you mean to then copy the fblib .jar file into the mainapp libs directory, correct? The only thing keeping me from doing that is then I am not able to reference any of the resources from fblib (layouts, icons, etc). As far as I know, the only thing that goes into a jar file is the src directory from the library project. – wufoo Apr 27 '12 at 19:52
  • @wufoo no, you just said you had jars and experimented with 'lib' directories - if all that was irrelevant let me know – JRaymond Apr 27 '12 at 20:16
  • JRaymond - no, you were onto something there. Now that I think about it, I bet I did use just 'lib' (I'm a Unix hack). I just went back and tried it again with "libs". I had to mess with the imports a bit which I think I missed last time, but I think it's finally working :) Big thanks! PS: also a note about res/ in the jar files. That's apparently been changed last year. I guess I hadn't bothered to try the .jar files since then (http://android-developers.blogspot.com/2011/10/changes-to-library-projects-in-android.html) – wufoo Apr 27 '12 at 20:22
0

I've also noticed in my own projects, under Java Build Path > Order and Export, I sometimes need to go in and make sure all my linked sources have their boxes checked.

ootinii
  • 1,795
  • 20
  • 15
  • Thanks. I've experimented with that as one post I read said exporting a library twice can cause the "Conversion Dalvik format..." error. – wufoo Apr 27 '12 at 19:57
0

I had similar issues. The issues were because of different build system introduced "Gradle".

Resolution: Forcibly open Android SDK Manager, and take update to install 1. Android SDK Build Tools revision 17 2. Android SDK platform tools revision 17 3. Android SDK tools revision 17

From all library project dont forget to enable "Android Private Libraries" the check box inside properties-> order and export.

Thanks.

Lavakush
  • 1,910
  • 2
  • 11
  • 14