0

你好 stackoverflow 社区,

我是android编程的新手。我创建的应用程序“加密”总是在模拟器上崩溃,并显示消息“不幸的是,加密已停止”。我正在关注本教程:https ://www.sites.google.com/site/mobilesecuritylabware/3-data-location-privacy/lab-activity/cryptography/cryptography-mobile-labs/encryption-decryption/2-lab -活动/实验室1。谁能帮我找出问题所在?
非常感谢!

详细信息:
Mac OS X 10.7.5,Eclipse SDK 版本:4.2.2 构建 ID:M20130204-1200

EncryptActivity.java 代码在上面给出的链接上。
应用程序名称:加密
活动:EncryptActivity
包名称:Android.Encrypt

这是日志猫:

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>
4

1 回答 1

1

问题是您在其中指定了相关类名活动,android:name而 android 会将该名称附加到您指定的名称中,然后 android在活动元素中得到Android.Encrypt.Android.Encrypt.EncryptActivity了 Android.Encrypt.EncryptActivity .Android.Encrypt.EncryptActivity` 而不是。just remove the dot of

于 2013-10-28T15:30:38.133 回答