The following code is from an Android app which has a library, a trial and a full app. In the project properties, the library is set as library and in trial/full the library is referenced. However, I seem to have missed something in naming the packages or the android:name(s):
If I try to run the full app, the app stops on the mobile with the following message:
E/AndroidRuntime(28658): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{at.prm.privatecalls/at.prm.privatecalls.library.SettingsActivity}: java.lang.ClassNotFoundException: Didn't find class "at.prm.privatecalls.library.SettingsActivity" on path: /data/app/at.prm.privatecalls-1.apk
Manifest of lib:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.prm.privatecalls.library"
android:versionCode="1"
android:versionName="@string/versionname" >
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="SettingsActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</application>
Manifest of app:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.prm.privatecalls"
android:versionCode="1"
android:versionName="@string/versionname" >
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="at.prm.privatecalls.library.SettingsActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</application>
I startet with a fresh app, created library and two projects for full and trial and then copied over the code. Works, however, I do not know the reason for the error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.