我重新安装了 ADT Bundle,因为我在更新 eclipse 后遇到了一些问题。
现在,当我想测试我的应用程序时,出现以下异常:
06-05 10:33:35.770: E/AndroidRuntime(17751): FATAL EXCEPTION: main
06-05 10:33:35.770: E/AndroidRuntime(17751): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{foo.bar/foo.bar.TabsFragmentActivity}: java.lang.ClassNotFoundException: foo.bar.TabsFragmentActivity in loader dalvik.system.PathClassLoader[/data/app/foo.bar-2.apk]
06-05 10:33:35.770: E/AndroidRuntime(17751): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
06-05 10:33:35.770: E/AndroidRuntime(17751): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1670)
06-05 10:33:35.770: E/AndroidRuntime(17751): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-05 10:33:35.770: E/AndroidRuntime(17751): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-05 10:33:35.770: E/AndroidRuntime(17751): at android.os.Handler.dispatchMessage(Handler.java:99)
06-05 10:33:35.770: E/AndroidRuntime(17751): at android.os.Looper.loop(Looper.java:130)
06-05 10:33:35.770: E/AndroidRuntime(17751): at android.app.ActivityThread.main(ActivityThread.java:3695)
06-05 10:33:35.770: E/AndroidRuntime(17751): at java.lang.reflect.Method.invokeNative(Native Method)
06-05 10:33:35.770: E/AndroidRuntime(17751): at java.lang.reflect.Method.invoke(Method.java:507)
06-05 10:33:35.770: E/AndroidRuntime(17751): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
06-05 10:33:35.770: E/AndroidRuntime(17751): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
06-05 10:33:35.770: E/AndroidRuntime(17751): at dalvik.system.NativeStart.main(Native Method)
06-05 10:33:35.770: E/AndroidRuntime(17751): Caused by: java.lang.ClassNotFoundException: foo.bar.TabsFragmentActivity in loader dalvik.system.PathClassLoader[/data/app/foo.bar-2.apk]
06-05 10:33:35.770: E/AndroidRuntime(17751): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
06-05 10:33:35.770: E/AndroidRuntime(17751): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
06-05 10:33:35.770: E/AndroidRuntime(17751): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-05 10:33:35.770: E/AndroidRuntime(17751): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-05 10:33:35.770: E/AndroidRuntime(17751): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
06-05 10:33:35.770: E/AndroidRuntime(17751): ... 11 more
这是清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="foo.bar"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="foo.bar.ui.tabs.TabsFragmentActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="foo.bar.ui.activities.EditActivity"
android:parentActivityName="foo.bar.ui.tabs.TabsFragmentActivity"
android:windowSoftInputMode="stateHidden">
</activity>
<activity
android:name="foo.bar.ui.activities.LocationActivity"
android:label="Select a location"
android:parentActivityName="foo.bar.ui.tabs.TabsFragmentActivity" >
</activity>
<activity
android:name="foo.bar.ui.activities.DeleteLocationsActivity"
android:label="Delete locations"
android:parentActivityName="foo.bar.ui.activities.LocationActivity" >
</activity>
<activity
android:name="foo.bar.ui.activities.ShowLocationActivity"
android:parentActivityName="foo.bar.ui.activities.LocationActivity" >
</activity>
<activity
android:name="foo.bar.ui.activities.ShowSnapshotActivity"
android:parentActivityName="foo.bar.ui.activities.ShowLocationActivity" >
</activity>
<service
android:name="foo.bar.service.SnapshotService" >
</service>
</application>
</manifest>
我认为它与包装有关,即。它查看活动的错误位置,但我不知道如何修复它。
我尝试清理项目并在清单中仅使用“.activityname”,但这两个都不起作用。
编辑:我现在通过将 TabsFragmentActivity 移动到标准包然后回到 ui.tabs 来让它工作。
不知道为什么这会奏效。
感谢你的帮助