user2168503
user2168503

Reputation: 1

Eclipse android app crashes when launch on emulator

Hello stackoverflow community,

I'm new to android programming. The app I create,"Encrypt", always crashes on the emulator with the message " Unfortunately, Encrypt has stopped". I'm following this tutorial: https://www.sites.google.com/site/mobilesecuritylabware/3-data-location-privacy/lab-activity/cryptography/cryptography-mobile-labs/encryption-decryption/2-lab-activity/lab1. Can anyone help me figure out what's wrong?
Thanks a lot!

Details:
Mac OS X 10.7.5, Eclipse SDK Version: 4.2.2 Build id: M20130204-1200

The EncryptActivity.java code is on the link given above.
Application name: Encrypt
Activity: EncryptActivity
Package name: Android.Encrypt

This is the 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

Here is the Manifest info :

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

Upvotes: 0

Views: 2224

Answers (1)

Jans
Jans

Reputation: 11250

The problem is you're specifing relative class name activity in android:name and android is going to append that name to your indicated name, then android got Android.Encrypt.Android.Encrypt.EncryptActivity instead of Android.Encrypt.EncryptActivityjust remove the dot of.Android.Encrypt.EncryptActivity` in activity element.

Upvotes: 1

Related Questions