修复上述错误: - 将应用程序支持库作为项目从sdk / extras / android / support / v7
导入现在我有这个错误:
12-04 05:54:16.067: E/AndroidRuntime(1749): FATAL EXCEPTION: main
12-04 05:54:16.067: E/AndroidRuntime(1749): Process: com.tfg.webquest, PID: 1749
12-04 05:54:16.067: E/AndroidRuntime(1749): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.tfg.webquest/com.tfg.webquest.SplashScreenActivity}: java.lang.ClassNotFoundException: Didn't find class "com.tfg.webquest.SplashScreenActivity" on path: DexPathList[[zip file "/data/app/com.tfg.webquest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.tfg.webquest-1, /system/lib]]
12-04 05:54:16.067: E/AndroidRuntime(1749): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
12-04 05:54:16.067: E/AndroidRuntime(1749): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
12-04 05:54:16.067: E/AndroidRuntime(1749): at android.app.ActivityThread.access$800(ActivityThread.java:135)
12-04 05:54:16.067: E/AndroidRuntime(1749): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
12-04 05:54:16.067: E/AndroidRuntime(1749): at android.os.Handler.dispatchMessage(Handler.java:102)
12-04 05:54:16.067: E/AndroidRuntime(1749): at android.os.Looper.loop(Looper.java:136)
12-04 05:54:16.067: E/AndroidRuntime(1749): at android.app.ActivityThread.main(ActivityThread.java:5017)
12-04 05:54:16.067: E/AndroidRuntime(1749): at java.lang.reflect.Method.invokeNative(Native Method)
12-04 05:54:16.067: E/AndroidRuntime(1749): at java.lang.reflect.Method.invoke(Method.java:515)
12-04 05:54:16.067: E/AndroidRuntime(1749): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-04 05:54:16.067: E/AndroidRuntime(1749): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-04 05:54:16.067: E/AndroidRuntime(1749): at dalvik.system.NativeStart.main(Native Method)
12-04 05:54:16.067: E/AndroidRuntime(1749): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.tfg.webquest.SplashScreenActivity" on path: DexPathList[[zip file "/data/app/com.tfg.webquest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.tfg.webquest-1, /system/lib]]
12-04 05:54:16.067: E/AndroidRuntime(1749): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-04 05:54:16.067: E/AndroidRuntime(1749): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-04 05:54:16.067: E/AndroidRuntime(1749): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-04 05:54:16.067: E/AndroidRuntime(1749): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
12-04 05:54:16.067: E/AndroidRuntime(1749): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
12-04 05:54:16.067: E/AndroidRuntime(1749): ... 11 more
我已经解决了我在开头时遇到的java.lang.NoSuchFieldError。
可以使用此信息来解决错误:(谢谢)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tfg.webquest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".SplashScreenActivity"
android:label="@string/title_activity_splash_screen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
</activity>
<activity
android:name=".HomeActivity"
android:label="@string/title_activity_home" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.tfg.webquest.MainActivity" />
</activity>
<activity
android:name=".RegisterActivity"
android:label="@string/title_activity_register" >
</activity>
<activity
android:name=".RegisterCourseActivity"
android:label="@string/title_activity_register_course" >
</activity>
<activity
android:name=".RegisterSubjectActivity"
android:label="@string/title_activity_register_subject" >
</activity>
<activity
android:name=".RegisterSubjectsActivity"
android:label="@string/title_activity_list_view_checkboxes" >
</activity>
<activity
android:name=".QuestIntroActivity"
android:label="@string/title_quest_intro_activity" >
</activity>
<activity
android:name=".QuestActivity"
android:label="@string/title_quest_activity" >
</activity>
<activity
android:name=".StatisticActivity"
android:label="@string/StatisticActivity" >
</activity>
<activity
android:name=".GameFinishedActivity"
android:label="@string/GameFinishedActivity" >
</activity>
<activity
android:name=".SettingsActivity"
android:label="@string/title_activity_settings" >
</activity>
</application>
</manifest>
答案 0 :(得分:0)
我认为我们可以在答案中总结评论讨论,因为它现在很明显。您没有正确地将android支持库v7添加到您的项目中。您必须将其添加为Android库(带有资源),而不仅仅是jar到libs文件夹。关注support v7。