0

I took a fully working application and copied it and made it a library (Properties -> Android, Is Library). I also renamed this project to keep track of it separately - com.mylib.

I then took the original application com.myapp and removed all the .java files except for one with some data (no actual code). I linked this up via Properties -> Android, and in the Library section added in the mylib library. It shows up with a green check.

Changed the myapp's manifest activities to all have the library as the prefix as recommended by Google.

android:name="com.mylib.AppInfo"

Cleaned both the library and the project, and exited and restarted Eclipse as well. Compiles fine, and the program runs the main activity "AppInfo", but attempting to get to other activities always fails with ClassNotFoundException.

I've also tried different name prefixes in the myapp manifest such as:

android:name="com.myapp.AppInfo"
android:name=".AppInfo"

But these fail to get to the main app. Although no activity class names were changed in the library or the myapp manifest, I've reviewed them character by character to be sure they all match up both in case and exact letter.

Using Eclipse under Windows 7 x64, and the app is set for minSdk of 11. Latest SDK tools also loaded (v20.0.3). Also Proguard is not being used (yet), and I'm using actual hardware (Android 4.0).

I'm pulling my hair out trying to get the library to work. I have a completely different library and app pair working the same way on another project, and I've compared every property and option between the two libraries and projects and can't find anything that is missing or added that causes this to fail.

Here's the full error from LogCat:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapp/com.myapp.LiveWallpaperSettings}: java.lang.ClassNotFoundException: com.myapp.LiveWallpaperSettings

Any suggestions or ideas on how to track this down?

Frank
  • 605
  • 1
  • 8
  • 14
  • 1
    After you selected it as a library, it had the green check. once you clicked OK, and reopened the project settings, does it still appear as a green check? Does the library project's folder is in the same location as your project's folder? – La bla bla Nov 08 '12 at 22:41
  • See if this post helps you: http://stackoverflow.com/questions/2680827/conversion-to-dalvik-format-failed-with-error-1-on-external-jar/8666234#8666234 – user123321 Nov 08 '12 at 22:54
  • is green check mark is showing? as @Lablabla metioned ? – Juned Nov 09 '12 at 05:11
  • Yep, green checkmark appears. Musselwhizzle, the reference to 2680827 had some good ideas, but even trying some of the more complex ones didn't solve it. For example: Delete project from Eclipse; Delete files in \bin and \gen from project folder; Restart Eclipse with command line : eclipse -clean; Import project; Right click on project - select Properties > Java Build Path > Libraries and remove everything else than Android XX.Y; Remove Library from properties and click OK; Add back in library and click OK; Clean project. Problem still occurs. – Frank Nov 10 '12 at 00:00

0 Answers0