-2

I am trying to call activity of library into application project but I am getting error as following:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sumeru.crop.activity.DSTakePictureActivity" on path: DexPathList[dexElements=[zip file "/data/app/------.ensource-1.apk"],nativeLibraryDirectories=[/data/app-lib/------.ensource-1, /vendor/lib, /system/lib]]

My package name is ---------.ensource but I am getting .ensource-1 instead.

The code I am using to call activity of library:

intent = new Intent();
intent.setClass(getApplicationContext(), Class.forName("com.sumeru.crop.activity.DSTakePictureActivity"));
            startActivity(intent);

Please help me out; I am open to all suggestions.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
Guna Sekhar
  • 355
  • 1
  • 3
  • 14

1 Answers1

0

The AndroidManifiest for your Lib Activity has to be like this:

<activity
        android:name="com.name.of.activity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="com.name.of.activity" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
</activity>

And the you can call it with:

new Intent("com.name.of.activity")

And do not forget to add the lib in your gradle:

compile project(':libname')
Alejandro Alcalde
  • 5,990
  • 6
  • 39
  • 79