noob在这里寻求帮助。
我正在为我的Android应用程序使用Eclipse,为虚拟机使用Bluestacks。
我用按钮创建了一个快速的Android应用程序项目。以下是我的按钮代码:
public void doSomething(View v) {
Intent i = new Intent(this, com.viva.demo.MainActivity.class);
startActivity(i);
/*Intent i = new Intent();
i.setClassName("com.wodota.test123", "com.viva.demo.MainActivity.class");*/
}
以下是清单文件的代码。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wodota.test123"
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>
<activity android:name="com.viva.demo.MainActivity" />
</application>
</manifest>
我在我的清单文件“com.viva.demo.MainActivity”中包含了一项活动。 同样在我的项目中,我已经包含了JAR文件。
下面是我的logcat:
08-20 11:47:33.767: D/AndroidRuntime(8573): Shutting down VM
08-20 11:47:33.767: W/dalvikvm(8573): threadid=1: thread exiting with uncaught exception (group=0xb2cd0180)
08-20 11:47:33.767: I/Process(8573): Sending signal. PID: 8573 SIG: 9
08-20 11:47:33.767: D/AndroidRuntime(8573): procName from cmdline: com.wodota.test123
08-20 11:47:33.767: E/AndroidRuntime(8573): in writeCrashedAppName, pkgName :com.wodota.test123
08-20 11:47:33.767: D/AndroidRuntime(8573): file written successfully with content: com.wodota.test123 StringBuffer : ;com.wodota.test123
08-20 11:47:33.767: E/AndroidRuntime(8573): FATAL EXCEPTION: main
08-20 11:47:33.767: E/AndroidRuntime(8573): java.lang.IllegalStateException: Could not execute method of the activity
08-20 11:47:33.767: E/AndroidRuntime(8573): at android.view.View$1.onClick(View.java:3044)
08-20 11:47:33.767: E/AndroidRuntime(8573): at android.view.View.performClick(View.java:3511)
08-20 11:47:33.767: E/AndroidRuntime(8573): at android.view.View$PerformClick.run(View.java:14105)
08-20 11:47:33.767: E/AndroidRuntime(8573): at android.os.Handler.handleCallback(Handler.java:605)
08-20 11:47:33.767: E/AndroidRuntime(8573): at android.os.Handler.dispatchMessage(Handler.java:92)
08-20 11:47:33.767: E/AndroidRuntime(8573): at android.os.Looper.loop(Looper.java:137)
08-20 11:47:33.767: E/AndroidRuntime(8573): at android.app.ActivityThread.main(ActivityThread.java:4424)
08-20 11:47:33.767: E/AndroidRuntime(8573): at java.lang.reflect.Method.invokeNative(Native Method)
08-20 11:47:33.767: E/AndroidRuntime(8573): at java.lang.reflect.Method.invoke(Method.java:511)
08-20 11:47:33.767: E/AndroidRuntime(8573): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
08-20 11:47:33.767: E/AndroidRuntime(8573): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
08-20 11:47:33.767: E/AndroidRuntime(8573): at dalvik.system.NativeStart.main(Native Method)
08-20 11:47:33.767: E/AndroidRuntime(8573): Caused by: java.lang.reflect.InvocationTargetException
08-20 11:47:33.767: E/AndroidRuntime(8573): at java.lang.reflect.Method.invokeNative(Native Method)
08-20 11:47:33.767: E/AndroidRuntime(8573): at java.lang.reflect.Method.invoke(Method.java:511)
08-20 11:47:33.767: E/AndroidRuntime(8573): at android.view.View$1.onClick(View.java:3039)
08-20 11:47:33.767: E/AndroidRuntime(8573): ... 11 more
08-20 11:47:33.767: E/AndroidRuntime(8573): Caused by: java.lang.NoClassDefFoundError: com.viva.demo.MainActivity
08-20 11:47:33.767: E/AndroidRuntime(8573): at com.wodota.test123.MainActivity.doSomething(MainActivity.java:24)
08-20 11:47:33.767: E/AndroidRuntime(8573): ... 14 more
08-20 12:37:45.407: D/AndroidRuntime(9743): Shutting down VM
我的应用程序崩溃了。我认为我的清单文件中存在问题。下面是我为Intent Function获得的教程,并且正在运行:
https://www.youtube.com/watch?v=qurvm-E9AiU
请帮忙。