NoClassDeFoundException-----解决的终极之道

来源:互联网 发布:ice框架 java 编辑:程序博客网 时间:2024/04/28 15:08

自从引入了友盟分享的jar包以及各种so文件之后,我的应用就报各种的NoClassDeFoundException,刚开始的时候是报

Error:warning: Ignoring InnerClasses attribute for an anonymous inner classError:(com.umeng.socialize.d) that doesn't come with anError:associated EnclosingMethod attribute. This class was probably produced by aError:compiler that did not target the modern .class file format. The recommendedError:solution is to recompile the class from source, using an up-to-date compilerError:and without specifying any "-target" type options. The consequence of ignoringError:this warning is that reflective operations on this class will incorrectlyError:indicate that it is *not* an inner class.

但是后来不知道怎么滴,虽然报这个错误,但是应用还能装到手机上,但是一运行就会报NoClassDeFoundException,
甚至在周六,在家躺着休息都不安心,终于潜入海中,找答案!!!!
MD!功夫不负有心人,在友盟论坛上终于找到了解决问题的办法。。。
附上链接:
http://www.cnblogs.com/yeahgis/p/4660873.html
从这个链接引向了另外一个StackOverFlow的链接:
http://stackoverflow.com/questions/27377080/after-update-of-as-to-1-0-getting-method-id-not-in-0-0xffff-65536-error-i

我的解决办法就是按照上面的解决办法设置的。。终于应用恢复正常了!!!
附上我的gradle文件

android{ defaultConfig {        minSdkVersion 11        targetSdkVersion 23        versionCode 3        versionName PROJECT_VERSION_NAME        multiDexEnabled true    }    dexOptions {        preDexLibraries true        javaMaxHeapSize "4g"        incremental true        dexInProcess = true    }}
dependencies {compile 'com.android.support:multidex:1.0.0'}

然后让自己的Application 继承MultiDexApplication ,在清单文件里面一定要声明自己的Application

 android:name=".Profile"

当然,这里我是自己写了Application,上面链接里面,作者也说了如果自己没有写Application的解决方法。

希望能帮助到需要的童鞋,不要向我一样走弯路了。
等我把项目完成,会再写个关于分享的总结。这里面还是有坑要采的!

再附上一个深度了解的链接:
https://developer.android.com/studio/build/multidex.html

0 0