Graeme
Graeme

Reputation: 25864

ADT 22 multiple library issues

I've got a set up like so:

NativeLibrary    CommonJavaComponents
   |      |            |      |
   |      |            |      |
   |     FunctionalLibrary1   |
   |            |             |
    ----------Project---------

Slightly complicated at first but this is one of my most simple sets ups.

I've managed to get everything compiling by exporting "Android Private Libraries".

Unfortunately on my device I'm getting this:

05-22 16:52:50.110: W/dalvikvm(3215): Unable to resolve superclass of Lcom/test/library/common/activity/LoggingActivity; (50)
05-22 16:52:50.110: W/dalvikvm(3215): Link of class 'Lcom/test/library/common/activity/LoggingActivity;' failed

LoggingActivity lives in CommonJavaComponents and extends FragmentActivity from android-support-v13.jar

Does anybody know what magic I need to perform or is ADT 22 just plain broken?

EDIT

For conciseness:

NativeLibrary, CommonJavaComponents, FunctionalLibrary1 all have Android Private Libraries exported. Project references all three, it compiles but still shows the above error.

Upvotes: 2

Views: 1845

Answers (2)

FINARX
FINARX

Reputation: 258

I also got the ClassNotFoundExcpetion for ARCA. The ACRA jar was located in one of our core library projects and imported to the app projects from that central place.

Uninstalling and installing the App (as suggested by Graeme) on the device did not change anything in my case. If that would have been the case this would make updating for the App users impossible and ADT 22 would have been unusable for production use.

I could track down the problem in several projects to the fact that we added jar files to the Java Build Path explicitly. This 2011 style habit of handling jars in the libs folder (I guess before ADT 17) has been preserved in many places in our apps.

I managed to get projects running with ADT 22 and tools 17 by simply replacing and standardizing ALL library project's .classpath files with the following content:

<classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="gen"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry kind="output" path="bin/classes"/> </classpath>

All jar files are removed and "Private Libraries" have to be exported like many others have stated before.

This was tested with API target 17 projects:

android.library=true
target=android-17

If you percieve remaining problems try to do the same with the root App project (i.e. the non-library project you try to run)


One thing to add: after you managed to get your app compiled and running you may see in the "Problems" View of eclipse after updating jars in your libs folder:

The container 'Android Private Libraries' references non existing library '.../FINARXAndroidWidgets/libs/jackson-core-2.1.1.jar'

The library variable's content cannot be edited by the user. The only thing that helped me was to restart eclipse.

The bad thing about this is that it might also happen after an SVN/GIT update in someone else's workspace.

Upvotes: 3

Graeme
Graeme

Reputation: 25864

Uninstalling the app and reinstalling seems to have fixed it. Android/Eclipse doesn't seem to have been able to have seen a change occurring when changing the export settings of it's dependent libraries so therefore didn't correctly rebuild or reinstall.

To confirm, the working setup involves Project referencing each of it's dependent libraries directly as Android Libraries. Each of the projects (even including Project although that shouldn't effect anything) are using export Android Private Libraries.

As with the update to ADT 16 - this should have contained a big flashing warning saying "This is going to break your project set up - please wait until you're NOT in a release cycle".

Upvotes: 0

Related Questions