我需要有人帮忙解决这个问题。运行并安装应用程序后,单击模拟器上的应用程序图标时,会出现以下错误,我不知道出了什么问题。我使用Scringo SDK作为库。
11-18 07:10:23.512: W/dalvikvm(918): Unable to resolve superclass of Lcom/iueamessenger/MainActivity (1010)
11-18 07:10:23.543: W/dalvikvm(918): Link of class 'Lcom/iueamessenger/MainActivity;' failed
11-18 07:10:23.553: D/AndroidRuntime(918): Shutting down VM
11-18 07:10:23.572: W/dalvikvm(918): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
11-18 07:10:23.603: E/AndroidRuntime(918): FATAL EXCEPTION: main
11-18 07:10:23.603: E/AndroidRuntime(918): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.iueamessenger/com.iueamessenger.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.iueamessenger.MainActivity" on path: /data/app/com.iueamessenger-1.apk
11-18 07:10:23.603: E/AndroidRuntime(918): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
11-18 07:10:23.603: E/AndroidRuntime(918): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
11-18 07:10:23.603: E/AndroidRuntime(918): at android.app.ActivityThread.access$600(ActivityThread.java:141)
11-18 07:10:23.603: E/AndroidRuntime(918): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
11-18 07:10:23.603: E/AndroidRuntime(918): at android.os.Handler.dispatchMessage(Handler.java:99)
11-18 07:10:23.603: E/AndroidRuntime(918): at android.os.Looper.loop(Looper.java:137)
11-18 07:10:23.603: E/AndroidRuntime(918): at android.app.ActivityThread.main(ActivityThread.java:5041)
11-18 07:10:23.603: E/AndroidRuntime(918): at java.lang.reflect.Method.invokeNative(Native Method)
11-18 07:10:23.603: E/AndroidRuntime(918): at java.lang.reflect.Method.invoke(Method.java:511)
11-18 07:10:23.603: E/AndroidRuntime(918): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
11-18 07:10:23.603: E/AndroidRuntime(918): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
11-18 07:10:23.603: E/AndroidRuntime(918): at dalvik.system.NativeStart.main(Native Method)
11-18 07:10:23.603: E/AndroidRuntime(918): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.iueamessenger.MainActivity" on path: /data/app/com.iueamessenger-1.apk
11-18 07:10:23.603: E/AndroidRuntime(918): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
11-18 07:10:23.603: E/AndroidRuntime(918): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
11-18 07:10:23.603: E/AndroidRuntime(918): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
11-18 07:10:23.603: E/AndroidRuntime(918): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
11-18 07:10:23.603: E/AndroidRuntime(918): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
11-18 07:10:23.603: E/AndroidRuntime(918): ... 11 more
11-18 07:10:30.733: I/Process(918): Sending signal. PID: 918 SIG: 9
以下是MainActivity.java类:
package com.iueamessenger;
import com.scringo.Scringo;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
private Scringo scringo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Scringo.setAppId("2LvLgedRxUvdu2prC83qfjmIYzA8by2c");
scringo = new Scringo(this);
scringo.init();
scringo.addSidebar();
Scringo.setDebugMode(true);
}
@Override
protected void onStart() {
super.onStart();
scringo.onStart();
}
@Override
protected void onStop() {
super.onStop();
scringo.onStop();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Android Manifest XML文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iueamessenger"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
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>
感谢您的帮助。
答案 0 :(得分:0)
显示应用程序未找到MainActivity的错误,尝试在Android.Manifest中编写具有完整包名称的ActivityName 喜欢 @Opiatefuchs 在评论中说。 声明活动名称不是 MainActivity ,而是声明为&#34; com.iueamessenger.MainActivity&#34;
答案 1 :(得分:0)
您的项目似乎没问题。 清理您的项目并重新启动SDK 。 它有时会发挥魔力。
如果问题仍然存在,您可以创建一个新项目并将其中的每个项目复制到新项目中。