继续[MonoDroid] Java.Lang.NoClassDefFoundError:抛出了类型'Java.Lang.NoClassDefFoundError'的异常。在发布模式下

时间:2015-06-24 22:59:18

标签: java android xamarin

如果我在调试模式下运行我的应用程序,一切正常。 如果我在发布模式下构建它,它会运行0错误但是一旦我启动应用程序,我就会在发布模式下出现以下错误

[MonoDroid] Java.Lang.NoClassDefFoundError:抛出了类型'Java.Lang.NoClassDefFoundError'的异常。

我该如何解决这个问题? 这是我的输出

 [monodroid] Trying to load sgen   from: /data/data/payment24_Mobile.payment24_Mobile/lib/libmonosgen-2.0.so
    [monodroid-gc] GREF GC Threshold: 46080
    [Notificare] Launching Notificare
    [MonoDroid] UNHANDLED EXCEPTION:
    [MonoDroid] Java.Lang.NoClassDefFoundError: Exception of    type 'Java.Lang.NoClassDefFoundError' was thrown.
    [MonoDroid] at   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw   () <0x00028>
    [MonoDroid] at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod   (intptr,intptr,intptr,Android.Runtime.JValue*) <0x000e7>
     [MonoDroid] at Android.App.Activity.OnCreate (Android.OS.Bundle) <0x001cb>
     [MonoDroid] at Payment24_Mobile.MainActivity.OnCreate (Android.OS.Bundle)  <0x00027>
     [MonoDroid] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_     (intptr,intptr,intptr) <0x0005b>
     [MonoDroid] at (wrapper dynamic-method) object.9bf92fe1-7a19-4e78-bb84-  935c3dfa8604 (intptr,intptr,intptr) <0x00043>
     [MonoDroid]   --- End of managed exception stack trace ---
     [MonoDroid] java.lang.NoClassDefFoundError:   android.support.v7.app.AppCompatDelegateImplV14
     [MonoDroid]    at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:93)
     [MonoDroid]    at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:77)
     [MonoDroid]    at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:429)
    [MonoDroid]     at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
    [MonoDroid]     at md5527bbe1570afed42e60989b1b5cbd5aa.MainActivity.n_onCreate(Native Method)
   [MonoDroid]  at md5527bbe1570afed42e60989b1b5cbd5aa.MainActivity.onCreate(MainActivity.java:30)
    [MonoDroid]     at android.app.Activity.performCreate(Activity.java:5047)
    [MonoDroid]     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
    [MonoDroid]     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
   [MonoDroid]  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
   [MonoDroid]  at android.app.ActivityThread.access$700(ActivityThread.java:134)
   [MonoDroid]  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
     [MonoDroid]    at android.os.Handler.dispatchMessage(Handler.java:99)
     [MonoDroid]    at android.os.Looper.loop(Looper.java:137)
    [MonoDroid]     at android.app.ActivityThread.main(ActivityThread.java:4867)
    [MonoDroid]     at java.lang.reflect.Method.invokeNative(Native Method)
    [MonoDroid]     at java.lang.reflect.Method.invoke(Method.java:511)
    [MonoDroid]     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
    [MonoDroid]     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
    [MonoDroid]     at dalvik.system.NativeStart.main(Native Method)
   [AndroidRuntime] Shutting down VM
  [AndroidRuntime] FATAL EXCEPTION: main
   [AndroidRuntime] java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
   [AndroidRuntime]     at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:93)
     [AndroidRuntime]   at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:77)
     [AndroidRuntime]   at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:429)
    [AndroidRuntime]    at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
    [AndroidRuntime]    at md5527bbe1570afed42e60989b1b5cbd5aa.MainActivity.n_onCreate(Native Method)
   [AndroidRuntime]     at md5527bbe1570afed42e60989b1b5cbd5aa.MainActivity.onCreate(MainActivity.java:30)
   [AndroidRuntime]     at android.app.Activity.performCreate(Activity.java:5047)
   [AndroidRuntime]     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
   [AndroidRuntime]     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
    [AndroidRuntime]    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
    [AndroidRuntime]    at android.app.ActivityThread.access$700(ActivityThread.java:134)
    [AndroidRuntime]    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1218)
   [AndroidRuntime]     at android.os.Handler.dispatchMessage(Handler.java:99)
    [AndroidRuntime]    at android.os.Looper.loop(Looper.java:137)
     [AndroidRuntime]   at android.app.ActivityThread.main(ActivityThread.java:4867)
    [AndroidRuntime]    at java.lang.reflect.Method.invokeNative(Native Method)
   [AndroidRuntime]     at java.lang.reflect.Method.invoke(Method.java:511)
    [AndroidRuntime]    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
     [AndroidRuntime]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
    [AndroidRuntime]    at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:0)

what are the steps for that? where is AppCompat located?

在此处下载支持库:

http://developer.android.com/tools/support-library/setup.html

如果您使用的是Eclipse:

转到顶部的标签页并选择(Windows - &gt; Android SDK Manager)。在“额外”部分下,选中“Android支持库”并检查其是否安装。

enter image description here

之后,可以在以下位置找到AppCompat库:

android-sdk/extras/android/support/v7/appcompat

您需要在Android项目中引用此AppCompat库。

将库导入Eclipse。

右键点击您的Android项目。

选择属性。

点击底部的“添加...”添加图书馆。

选择支持库

清理并重建您的项目。