gpt4 book ai didi

Android 应用无法启动 Activity 组件

转载 作者:行者123 更新时间:2023-11-30 03:14:45 26 4
gpt4 key购买 nike

我是一名新的 Android 程序员,我真的不知道如何解决我的问题。我的应用名称是 musteatandgo。我在模拟器上安装了 musteatandgo.apk,有时 eclipse 找不到设备,有时我会在模拟器上看到“应用程序未安装”或“应用程序(进程 com.musteatandgo)意外停止。”

12-01 14:25:48.338: D/AndroidRuntime(284): Shutting down VM
12-01 14:25:48.348: W/dalvikvm(284): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
12-01 14:25:48.368: E/AndroidRuntime(284): FATAL EXCEPTION: main
12-01 14:25:48.368: E/AndroidRuntime(284): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.musteatandgo/com.musteatandgo.MainActivity}: java.lang.NullPointerException: Argument 'applicationId' cannot be null
12-01 14:25:48.368: E/AndroidRuntime(284): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)

list

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.musteatandgo"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.musteatandgo.MainActivity$start"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name= ".Main">
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="1390160477887243"/>
<activity android:name="com.facebook.LoginActivity" android:label="MustEatandGo"></activity>
</application>

</manifest>

主要 Activity

package com.musteatandgo;


import android.os.Bundle;
import android.app.Activity;
import com.facebook.*;
import com.facebook.model.*;
import android.widget.TextView;
import android.content.Intent;


public class MainActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// start Facebook Login
Session.openActiveSession(this, true, new Session.StatusCallback() {

// callback when session changes state
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()) {

// make request to the /me API
Request.newMeRequest(session, new Request.GraphUserCallback() {

// callback after Graph API response with user object
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
TextView welcome = (TextView) findViewById(R.id.welcome);
welcome.setText("Hello " + user.getName() + "!");
}
}
});
}
}
});
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}


}

最佳答案

在您的 MANIFEST com.musteatandgo.MainActivity$start 中将其更改为 .MainActivity

关于Android 应用无法启动 Activity 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20313625/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com