tags:

views:

194

answers:

3

Hi!

When I start my (soon-to-be) android game (from eclipse) it opens, but immediately force-closes.

Logcat says:

07-09 17:12:35.709: ERROR/AndroidRuntime(3866): Uncaught handler: thread main exiting due to uncaught exception
07-09 17:12:35.719: ERROR/AndroidRuntime(3866): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.anselm.eickhoff.rhythm/org.anselm.eickhoff.rhythm.RhythmGameActivity}: java.lang.ClassNotFoundException: org.anselm.eickhoff.rhythm.RhythmGameActivity in loader dalvik.system.PathClassLoader@4001e740
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2497)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at android.app.ActivityThread.access$2200(ActivityThread.java:126)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at android.os.Looper.loop(Looper.java:123)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at android.app.ActivityThread.main(ActivityThread.java:4595)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at java.lang.reflect.Method.invokeNative(Native Method)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at java.lang.reflect.Method.invoke(Method.java:521)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at dalvik.system.NativeStart.main(Native Method)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866): Caused by: java.lang.ClassNotFoundException: org.anselm.eickhoff.rhythm.RhythmGameActivity in loader dalvik.system.PathClassLoader@4001e740
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2489)
07-09 17:12:35.719: ERROR/AndroidRuntime(3866):     ... 11 more

the interesting line here is (I think):

07-09 17:12:35.719: ERROR/AndroidRuntime(3866): Caused by: java.lang.ClassNotFoundException: org.anselm.eickhoff.rhythm.RhythmGameActivity in loader dalvik.system.PathClassLoader@4001e740

Which surprises me, because I have this class (in the right package)

edit: to clarify, added the first line which I had omitted (together with the imports)

package org.anselm.eickhoff.rhythm;
...
public class RhythmGameActivity extends Activity {


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

    }

    @Override
    public void onPause() {
    }
}

and that's all it does!

I also registered it in the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="org.anselm.eickhoff.rhythm"
      android:versionCode="1" android:versionName="pre-alpha">

    <uses-permission android:name="android.permission.INTERNET" />
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" android:hasCode="false">

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

</manifest> 

edit: this all has started since I renamed the activity from RhythmGame to RhythmGameActivity, but I am pretty sure I replaced all the references so maybe it is still wrongly chached somewhere? (I tried refreshing and cleaning the project)

Your help is really appreciated - im stuck!

A: 

I think just need refresh your project

File > refresh
Jorgesys
didn't help, but thx
Anselm Eickhoff
:o ups! thats a weird situation, I had something similar using Android SDK 2.2 and having android:name="foo" inside my Manifest.xml < application tag, I had to change only for android:label="foo"
Jorgesys
hmm it already is :label
Anselm Eickhoff
A: 

Perhaps your run configuration refers to the old name. Click on the little triangle next to the green run button, and select Run Configurations. Make sure the one for this project refers to the right activity name. Or just delete it and Eclipse will automatically make you a new one.

MatrixFrog
Thx I will try this as soon as 1. my internet works again and 2. I have resolved a pretty annoying usb connectivity issue with my HTC Hero (test device) (situation normal, all f*cked up)
Anselm Eickhoff
Tried setting specifically the right activity in the run configuration and after that deleting it and letting eclipse make a new one. still the same error in both cases...
Anselm Eickhoff
A: 

Not really a solution but this fixed it:

creating a new project from scratch and migrating the code

Please close this if something like it is possible here.

Thanks for all your ideas and thoughts!

Anselm Eickhoff