Android: Crash in app 3.0, which should be backward compatible

this is the next question of my question earlier this day .

I installed the compatibility package and restarted Eclipse. Then I created such an action using the Blundell code:

public class EntryActivitiy extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.about);

        int b = Integer.parseInt(Build.VERSION.SDK);
        if (b >= Build.VERSION_CODES.HONEYCOMB)
        {
            Log.i(getString(R.string.app_name), "Found A Tablet Running Honeycomb or newer");
            //nothing else in here yet
        }
        else
        {
            this.startActivity(new Intent(this, Main.class));
        }
    }

}

My manifest contains:

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

    <supports-screens android:smallScreens="false"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"/>

and

    <activity android:name="EntryActivity"
        android:label="@string/app_name" 
        android:noHistory="true">           

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    </activity>

In the project settings, I set the build target to 3.0, because otherwise I will get the error "HONEYCOMB cannot be resolved or is not a field".

Now, if I run it on my 2.2 AVD, the application will exit as follows:

05-27 14:13:54.270: ERROR/AndroidRuntime(329): FATAL EXCEPTION: main
05-27 14:13:54.270: ERROR/AndroidRuntime(329): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{/myPackage.EntryActivity}: java.lang.ClassNotFoundException: myPackage.EntryActivity in loader dalvik.system.PathClassLoader[/data/app/myPackage-1.apk]
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at android.os.Looper.loop(Looper.java:123)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at android.app.ActivityThread.main(ActivityThread.java:4627)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at java.lang.reflect.Method.invokeNative(Native Method)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at java.lang.reflect.Method.invoke(Method.java:521)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at dalvik.system.NativeStart.main(Native Method)
05-27 14:13:54.270: ERROR/AndroidRuntime(329): Caused by: java.lang.ClassNotFoundException: myPackage.EntryActivity in loader dalvik.system.PathClassLoader[/data/app/myPackage-1.apk]
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
05-27 14:13:54.270: ERROR/AndroidRuntime(329):     ... 11 more

If you tried it on your 2.3 phone, but you got a weird screen flicker and “HDMI is disabled” and other very strange messages in LogCat. I do not want to repeat this, so I cannot provide accurate messages.

What am I doing wrong?

,

:

. , , HC, . , .:/

+3
3

Misspelt!

:

 public class EntryActivitiy extends // here spellcheck

:

 <activity android:name=".EntryActivity"
    android:label="@string/app_name" 
    android:noHistory="true">  

>

, , :

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.something.something"
 ....

, , p > > >

+1

EntryActivity? myPackage?

+1

You need to specify the period before the class name of your activity in the manifest:

 <activity android:name=".EntryActivity"
+1
source

All Articles