我的主要项目正在工作并完成。我开始研究如何制作精简版/专业版,现在一切都搞砸了。Android Library
我制作了名为an 的主项目BibleTrivia
,现在有两个其他项目引用它,它们分别命名为BibleTriviaLite
和BibleTriviaPro
. 我以为我已经完成了所有工作,但是当我尝试运行精简版时,ClassNotFoundException
当它试图找到第一个活动时,我得到了一个SplashScreen
. 精简版和专业版是一样的SplashScreen
,所以我在库项目中有它。
我的问题是如何让这个结构正确,这样我就可以运行我的精简版和专业版而没有这个例外。
我在LogCat
下面展示了我的输出和我的文件结构。如果您需要任何进一步的信息,请告诉我。
日志猫
03-09 02:10:52.745: E/AndroidRuntime(4706): FATAL EXCEPTION: main
03-09 02:10:52.745: E/AndroidRuntime(4706): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{matt.lyons.bibletrivia.lite/matt.lyons.bibletrivia.lite.SplashScreen}: java.lang.ClassNotFoundException: Didn't find class "matt.lyons.bibletrivia.lite.SplashScreen" on path: /data/app/matt.lyons.bibletrivia.lite-1.apk
03-09 02:10:52.745: E/AndroidRuntime(4706): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
03-09 02:10:52.745: E/AndroidRuntime(4706): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-09 02:10:52.745: E/AndroidRuntime(4706): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-09 02:10:52.745: E/AndroidRuntime(4706): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-09 02:10:52.745: E/AndroidRuntime(4706): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 02:10:52.745: E/AndroidRuntime(4706): at android.os.Looper.loop(Looper.java:137)
03-09 02:10:52.745: E/AndroidRuntime(4706): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-09 02:10:52.745: E/AndroidRuntime(4706): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 02:10:52.745: E/AndroidRuntime(4706): at java.lang.reflect.Method.invoke(Method.java:511)
03-09 02:10:52.745: E/AndroidRuntime(4706): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-09 02:10:52.745: E/AndroidRuntime(4706): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-09 02:10:52.745: E/AndroidRuntime(4706): at dalvik.system.NativeStart.main(Native Method)
03-09 02:10:52.745: E/AndroidRuntime(4706): Caused by: java.lang.ClassNotFoundException: Didn't find class "matt.lyons.bibletrivia.lite.SplashScreen" on path: /data/app/matt.lyons.bibletrivia.lite-1.apk
03-09 02:10:52.745: E/AndroidRuntime(4706): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
03-09 02:10:52.745: E/AndroidRuntime(4706): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-09 02:10:52.745: E/AndroidRuntime(4706): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-09 02:10:52.745: E/AndroidRuntime(4706): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
03-09 02:10:52.745: E/AndroidRuntime(4706): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
03-09 02:10:52.745: E/AndroidRuntime(4706): ... 11 more
编辑
这是我的精简版的开始AndroidManifest
。这LogCat
就是 SplashScreen 活动的说法ClassNotFoundException
,因此它会读取下面的清单,但随后无法找到 SplashScreen 启动器活动。
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="matt.lyons.bibletrivia.lite"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/icon_lite"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".SplashScreen"
android:screenOrientation="portrait" >
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
android:label="@string/app_name"
android:name=".About"
android:screenOrientation="portrait" />
...
...more activities...
...
</manifest>