1

I had a Android APP with activity and everything. however, I am trying to turn it into library and use it in another app. the APP compiled as a JAR file just fine.

however, when I call an activity from jar file , it immediately fails with ClassNotFound exception.

this is how I am calling the intent:

    Intent dialerIntent = new Intent(this, SipHome.class);
    startActivity(dialerIntent);

here SipHome.class is defined in the library jar file.

The error that I get is:

05-23 17:23:36.081: E/AndroidRuntime(21634): java.lang.RuntimeException: Unable to get provider com.thaifi.remote.db.DBProvider: java.lang.ClassNotFoundException: com.thaifi.remote.db.DBProvider in loader dalvik.system.PathClassLoader[/data/app/com.thaifi.remote-2.apk]

any idea what might be the issue?

here is my manifest.xml for the jar file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.csipsimple"
    android:versionCode="1485"
    android:versionName="0.04-00" >

    <uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="15" />

</manifest>
Shrouk Khan
  • 1,440
  • 6
  • 27
  • 53
  • 1
    here is your ans http://stackoverflow.com/questions/9857539/noclassdeffounderror-when-googleanalyticstracker-getinstance/9857669#9857669 – Akram May 23 '12 at 10:33
  • actually i am adding the sourcecode of that library project to my current eclipse project, which works. this is not a compile time error, but runtime error.also i am on adt 1.8 – Shrouk Khan May 23 '12 at 10:57
  • nevertheless, i tried your suggestion..still no good :( – Shrouk Khan May 23 '12 at 10:58
  • could you please show us the image of the attached lib project? – Akram May 23 '12 at 11:09
  • sure..but what do you mean imange? a screenshot? http://www.flickr.com/photos/11145703@N06/7255006600/in/photostream – Shrouk Khan May 23 '12 at 11:23
  • trying to call activity from a jar file in android???? – Akram May 23 '12 at 11:30
  • yes! "however, when I call an activity from jar file , it immediately fails with ClassNotFound exception." is it even possible? that is what trying to figure out – Shrouk Khan May 23 '12 at 11:45

1 Answers1

0

this is simple as i found out.

simply declare the activity in manifest (even though the class for that activity is in another jar file) and call it like you would call any other activity.

Shrouk Khan
  • 1,440
  • 6
  • 27
  • 53