刚开始使用Android。我将现有项目导入 Eclipse,当我尝试使用以下错误日志运行它时它立即崩溃:
06-05 10:23:38.655: W/dalvikvm(1711): Unable to resolve superclass of Lresearch/diabetes/android/appcore/MobileUnitActivity; (39)
06-05 10:23:38.655: W/dalvikvm(1711): Link of class 'Lresearch/diabetes/android/appcore/MobileUnitActivity;' failed
06-05 10:23:38.655: D/AndroidRuntime(1711): Shutting down VM
06-05 10:23:38.655: W/dalvikvm(1711): threadid=1: thread exiting with uncaught exception (group=0x410ef300)
06-05 10:23:38.683: E/AndroidRuntime(1711): FATAL EXCEPTION: main
06-05 10:23:38.683: E/AndroidRuntime(1711): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{research.diabetes.android/research.diabetes.android.appcore.MobileUnitActivity}: java.lang.ClassNotFoundException: research.diabetes.android.appcore.MobileUnitActivity
06-05 10:23:38.683: E/AndroidRuntime(1711): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
06-05 10:23:38.683: E/AndroidRuntime(1711): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
06-05 10:23:38.683: E/AndroidRuntime(1711): at android.app.ActivityThread.access$600(ActivityThread.java:130)
06-05 10:23:38.683: E/AndroidRuntime(1711): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
06-05 10:23:38.683: E/AndroidRuntime(1711): at android.os.Handler.dispatchMessage(Handler.java:99)
06-05 10:23:38.683: E/AndroidRuntime(1711): at android.os.Looper.loop(Looper.java:137)
06-05 10:23:38.683: E/AndroidRuntime(1711): at android.app.ActivityThread.main(ActivityThread.java:4745)
06-05 10:23:38.683: E/AndroidRuntime(1711): at java.lang.reflect.Method.invokeNative(Native Method)
06-05 10:23:38.683: E/AndroidRuntime(1711): at java.lang.reflect.Method.invoke(Method.java:511)
06-05 10:23:38.683: E/AndroidRuntime(1711): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
06-05 10:23:38.683: E/AndroidRuntime(1711): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
06-05 10:23:38.683: E/AndroidRuntime(1711): at dalvik.system.NativeStart.main(Native Method)
06-05 10:23:38.683: E/AndroidRuntime(1711): Caused by: java.lang.ClassNotFoundException: research.diabetes.android.appcore.MobileUnitActivity
06-05 10:23:38.683: E/AndroidRuntime(1711): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-05 10:23:38.683: E/AndroidRuntime(1711): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-05 10:23:38.683: E/AndroidRuntime(1711): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-05 10:23:38.683: E/AndroidRuntime(1711): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
06-05 10:23:38.683: E/AndroidRuntime(1711): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
06-05 10:23:38.683: E/AndroidRuntime(1711): ... 11 more
我不太确定出了什么问题。有两个部分在起作用:AndroidCore 和 AndroidUnit_Mobile。AndroidCore 是应用程序的核心,MobileUnitActivity 所在的位置。AndroidUnit_Mobile 使用 AndroidCore 进行操作。我已经发布了以下两个部分的清单。
AndroidCore 清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="research.diabetes.android"
andrnCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<service android:enabled="true" android:name="research.diabetes.android.appcore.ConnectionService" /></application>
</manifest>
AndroidUnit_Mobile 的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="research.diabetes.android"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name="research.diabetes.android.appcore.MobileUnitActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="research.diabetes.android.appcore.EmergencyHandler" android:label="EmergencyMode" android:screenOrientation="portrait"/>
<activity android:name="research.diabetes.android.appcore.EmergencySplashScreen" android:label="EmergencySplashScreen" android:screenOrientation="portrait"/>
<service android:enabled="true" android:name="research.diabetes.android.appcore.ConnectionService" />
<receiver android:enabled="false" android:name="research.diabetes.android.appcore.DeviceStartIntentReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
</application>
</manifest>