2013-10-28 220 views
0

你好stackoverflow社區,Eclipse Android應用程序在模擬器上啓動時崩潰

我是新來的android編程。我創建的應用程序「加密」始終在模擬器上崩潰,並顯示消息「不幸,加密已停止」。我正在學習本教程:https://www.sites.google.com/site/mobilesecuritylabware/3-data-location-privacy/lab-activity/cryptography/cryptography-mobile-labs/encryption-decryption/2-lab-activity/lab1。任何人都可以幫我弄清楚什麼是錯的?
非常感謝!

詳情:
的Mac OS X 10.7.5, 的Eclipse SDK 版本:4.2.2 版本ID:M20130204-1200

的EncryptActivity.java代碼是上面給出的鏈接。
應用程序名稱:加密
活動:EncryptActivity
套餐名稱:Android.Encrypt

這是logcat的:

10-28 11:21:58.583: D/AndroidRuntime(1257): Shutting down VM 
10-28 11:21:58.583: W/dalvikvm(1257): threadid=1: thread exiting with uncaught exception (group=0x414c4700) 
10-28 11:21:58.603: E/AndroidRuntime(1257): FATAL EXCEPTION: main 
10-28 11:21:58.603: E/AndroidRuntime(1257): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{Android.Encrypt/Android.Encrypt.Android.Encrypt.EncryptActivity}: java.lang.ClassNotFoundException: Didn't find class "Android.Encrypt.Android.Encrypt.EncryptActivity" on path: DexPathList[[zip file "/data/app/Android.Encrypt-2.apk"],nativeLibraryDirectories=[/data/app-lib/Android.Encrypt-2, /system/lib]] 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at android.app.ActivityThread.access$600(ActivityThread.java:141) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at android.os.Handler.dispatchMessage(Handler.java:99) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at android.os.Looper.loop(Looper.java:137) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at android.app.ActivityThread.main(ActivityThread.java:5103) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at java.lang.reflect.Method.invokeNative(Native Method) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at java.lang.reflect.Method.invoke(Method.java:525) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at dalvik.system.NativeStart.main(Native Method) 
10-28 11:21:58.603: E/AndroidRuntime(1257): Caused by: java.lang.ClassNotFoundException: Didn't find class "Android.Encrypt.Android.Encrypt.EncryptActivity" on path: DexPathList[[zip file "/data/app/Android.Encrypt-2.apk"],nativeLibraryDirectories=[/data/app-lib/Android.Encrypt-2, /system/lib]] 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at android.app.Instrumentation.newActivity(Instrumentation.java:1061) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128) 
10-28 11:21:58.603: E/AndroidRuntime(1257):  ... 11 more 

這裏是清單信息:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="Android.Encrypt" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="8" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name=".Android.Encrypt.EncryptActivity" 
      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> 
+0

「.Android.Encrypt.EncryptActivity」 - 這個類是否存在? – user35443

回答

1

問題你是在android:name中指定相關的類名稱活動,並且android會追加該名稱到您指定的名稱,然後android得到Android.Encrypt.Android.Encrypt.EncryptActivity而不是Android.Encrypt.EncryptActivity just remove the dot of .Android.Encrypt.EncryptActivity`在activity元素中。

+0

刪除此點後,仿真器正在崩潰 –

相關問題