[英]Android Library project in Eclipse: RunTimeException ClassNotFoundException
The following code is from an Android app which has a library, a trial and a full app. 以下代码来自具有库,试用版和完整应用程序的Android应用程序。 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): 但是,我似乎在命名包或android:name时错过了一些东西:
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: 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. 工程,但是,我不知道错误的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.