-1
11-29 11:23:06.101: E/AndroidRuntime(301):  at 
com.mypackage.myapp.MainActivity.onCreate(MainActivity.java:41)

I usually don't see this unless it's a problem with the Manifest or the activity wasn't correctly initialized. Only problem is, it is both initialized and correctly, spelled, typed, etc, in the Manifest. Anyone have any other ideas what this could possibly be.

public class MainActivity extends FragmentActivity
{
    public static Intent loginActivityIntent;

    @Override
    protected void onCreate(Bundle MainActivityState)
    {
        super.onCreate(MainActivityState);
        setContentView(R.layout.activity_main);
Line41->loginActivityIntent = new Intent(this, LoginActivity.class);
    }
}

AndroidManifest.xml

LoginActivity
        <activity
            android:name="com.mypackage.myapp.LoginActivity"
            android:theme="@style/FullscreenTheme">
                <action android:name="android.intent.action.LOGIN"/>
                <category android:name="android.intent.category.DEFAULT"/>
        </activity>

At the top of this logcat it states "unable to resolve superclass of loginactivity. The LoginActivity is from Facebook SDK, the super class is FacebookActivity, and it's not throwing me an error during editing.

11-29 11:38:41.642: W/dalvikvm(330): Unable to resolve superclass of Lcom/limbones/profilelife/LoginActivity; (462)
11-29 11:38:41.683: W/dalvikvm(330): Link of class 'Lcom/limbones/profilelife/LoginActivity;' failed
11-29 11:38:41.683: W/dalvikvm(330): Unable to resolve superclass of Lcom/limbones/profilelife/PLLoginActivity; (471)
11-29 11:38:41.683: W/dalvikvm(330): Link of class 'Lcom/limbones/profilelife/PLLoginActivity;' failed
11-29 11:38:41.692: E/dalvikvm(330): Could not find class 'com.limbones.profilelife.PLLoginActivity', referenced from method com.limbones.profilelife.PLMainActivity.onCreate
11-29 11:38:41.692: W/dalvikvm(330): VFY: unable to resolve const-class 475 (Lcom/limbones/profilelife/PLLoginActivity;) in Lcom/limbones/profilelife/PLMainActivity;
11-29 11:38:41.692: D/dalvikvm(330): VFY: replacing opcode 0x1c at 0x000a
11-29 11:38:41.702: D/dalvikvm(330): VFY: dead code 0x000c-002b in Lcom/limbones/profilelife/PLMainActivity;.onCreate (Landroid/os/Bundle;)V
11-29 11:38:41.942: D/AndroidRuntime(330): Shutting down VM
11-29 11:38:41.942: W/dalvikvm(330): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-29 11:38:42.072: E/AndroidRuntime(330): FATAL EXCEPTION: main
11-29 11:38:42.072: E/AndroidRuntime(330): java.lang.NoClassDefFoundError: com.limbones.profilelife.PLLoginActivity
11-29 11:38:42.072: E/AndroidRuntime(330):  at com.limbones.profilelife.PLMainActivity.onCreate(PLMainActivity.java:43)
11-29 11:38:42.072: E/AndroidRuntime(330):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-29 11:38:42.072: E/AndroidRuntime(330):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-29 11:38:42.072: E/AndroidRuntime(330):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-29 11:38:42.072: E/AndroidRuntime(330):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-29 11:38:42.072: E/AndroidRuntime(330):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-29 11:38:42.072: E/AndroidRuntime(330):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-29 11:38:42.072: E/AndroidRuntime(330):  at android.os.Looper.loop(Looper.java:123)
11-29 11:38:42.072: E/AndroidRuntime(330):  at android.app.ActivityThread.main(ActivityThread.java:4627)
11-29 11:38:42.072: E/AndroidRuntime(330):  at java.lang.reflect.Method.invokeNative(Native Method)
11-29 11:38:42.072: E/AndroidRuntime(330):  at java.lang.reflect.Method.invoke(Method.java:521)
11-29 11:38:42.072: E/AndroidRuntime(330):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-29 11:38:42.072: E/AndroidRuntime(330):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-29 11:38:42.072: E/AndroidRuntime(330):  at dalvik.system.NativeStart.main(Native Method)
11-29 11:38:44.592: I/Process(330): Sending signal. PID: 330 SIG: 9

UPDATE:

This is the only thing that is different in my Manifest

    <activity
        android:name="com.facebook.LoginActivity"
        android:label="">
        <action android:name="android.intent.action.LOGINACTIVITY"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </activity>

The activity it links to is just called LoginActivity, should I have included the prefixes as well?

LoginActivity.java

package com.limbones.profilelife;

import android.os.Bundle;
import android.widget.TextView;

import com.facebook.FacebookActivity;
import com.facebook.Request;
import com.facebook.Response;
import com.facebook.SessionState;
import com.facebook.model.GraphUser;

public class LoginActivity extends FacebookActivity
{
    public void onCreate(Bundle LoginActivity)
    {
        super.onCreate(LoginActivity);
        setContentView(R.layout.facebook_login_activity);
        this.openSession();
    }

    @Override
    protected void onSessionStateChange(SessionState state, Exception exception)
    {
        if (state.isOpened())
        {
            @SuppressWarnings("unused")
            Request request = Request.newMeRequest(
            this.getSession(), new Request.GraphUserCallback()
            {
                @Override
                public void onCompleted(GraphUser user, Response response)
                {
                    if (user != null)
                    {
                        TextView welcome = (TextView) findViewById(R.id.facebookWelcome);
                        welcome.setText("Hello " + user.getName() + "!");
                    }
                }
            });
        }
    }
}

PLLoginActivity.Java

package com.limbones.profilelife;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class PLLoginActivity extends LoginActivity
{
    public Intent registerActivityIntent;
    public Intent notImplementedIntent;
    public Intent facebookLoginIntent;

    public void onCreate(Bundle LoginPage)
    {
        super.onCreate(LoginPage);
        setContentView(R.layout.login_page);
        registerActivityIntent = new Intent(this, PLRegisterActivity.class);
        notImplementedIntent = new Intent(this, PLNotImplemented.class);
        facebookLoginIntent = new Intent(this, LoginActivity.class);
    }

    public void backButton(View v)
    {
        finish();
    }

    public void registerButton(View v)
    {
        this.startActivity(registerActivityIntent);
    }

    public void loginButton(View v)
    {
        this.startActivity(notImplementedIntent);
    }

    public void fbLogin(View v)
    {
        this.startActivity(facebookLoginIntent);
    }
}
4

1 に答える 1

0

I would check the project setup. From your logcat:

11-29 11:38:41.642: W/dalvikvm(330): Unable to resolve superclass of Lcom/limbones/profilelife/LoginActivity; (462)
11-29 11:38:41.683: W/dalvikvm(330): Link of class 'Lcom/limbones/profilelife/LoginActivity;' failed
11-29 11:38:41.683: W/dalvikvm(330): Unable to resolve superclass of Lcom/limbones/profilelife/PLLoginActivity; (471)
11-29 11:38:41.683: W/dalvikvm(330): Link of class 'Lcom/limbones/profilelife/PLLoginActivity;' failed

Seems like you are missing the FacebookActivity?

于 2012-11-29T18:54:16.233 に答える