- 主項目依賴於名爲'sf'的庫。
在庫 '科幻',使用意向,開始新的activeity使用意圖在jar中啓動新活動時發生java.lang.NoClassDefFoundError
import com.sf.proxy.MainActivity; public void login(Activity context) { Intent intent = new Intent(context,MainActivity.class); context.startActivity(intent); }
我得到了一個異常說:
02-06 10:07:58.198: D/AndroidRuntime(9770): Shutting down VM
02-06 10:07:58.198: W/dalvikvm(9770): threadid=1: thread exiting with uncaught exception (group=0xa6251288)
02-06 10:07:58.198: E/AndroidRuntime(9770): FATAL EXCEPTION: main
02-06 10:07:58.198: E/AndroidRuntime(9770): java.lang.IllegalStateException: Could not execute method of the activity
02-06 10:07:58.198: E/AndroidRuntime(9770): at android.view.View$1.onClick(View.java:3591)
02-06 10:07:58.198: E/AndroidRuntime(9770): at android.view.View.performClick(View.java:4084)
02-06 10:07:58.198: E/AndroidRuntime(9770): at android.view.View$PerformClick.run(View.java:16966)
02-06 10:07:58.198: E/AndroidRuntime(9770): at android.os.Handler.handleCallback(Handler.java:615)
02-06 10:07:58.198: E/AndroidRuntime(9770): at android.os.Handler.dispatchMessage(Handler.java:92)
02-06 10:07:58.198: E/AndroidRuntime(9770): at android.os.Looper.loop(Looper.java:137)
02-06 10:07:58.198: E/AndroidRuntime(9770): at android.app.ActivityThread.main(ActivityThread.java:4745)
02-06 10:07:58.198: E/AndroidRuntime(9770): at java.lang.reflect.Method.invokeNative(Native Method)
02-06 10:07:58.198: E/AndroidRuntime(9770): at java.lang.reflect.Method.invoke(Method.java:511)
02-06 10:07:58.198: E/AndroidRuntime(9770): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
02-06 10:07:58.198: E/AndroidRuntime(9770): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-06 10:07:58.198: E/AndroidRuntime(9770): at dalvik.system.NativeStart.main(Native Method)
02-06 10:07:58.198: E/AndroidRuntime(9770): Caused by: java.lang.reflect.InvocationTargetException
02-06 10:07:58.198: E/AndroidRuntime(9770): at java.lang.reflect.Method.invokeNative(Native Method)
02-06 10:07:58.198: E/AndroidRuntime(9770): at java.lang.reflect.Method.invoke(Method.java:511)
02-06 10:07:58.198: E/AndroidRuntime(9770): at android.view.View$1.onClick(View.java:3586)
02-06 10:07:58.198: E/AndroidRuntime(9770): ... 11 more
02-06 10:07:58.198: E/AndroidRuntime(9770): Caused by: java.lang.NoClassDefFoundError: com.sf.proxy.MainActivity
的Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sample">
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true" />
<application
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name="com.sf.proxy.MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="sensor"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
......
我知道這個例外意味着什麼,所以首先我看着罐子裏面e,和「失蹤」的課程確實存在。所有人都經歷過這種情況?提前致謝。
我沒有將任何資源打包到jar中,只是源代碼和異常說'java.lang.NoClassDefFoundError',而不是資源。 – zsounder