美文网首页
找不到类,的解决办法:Didn't find class "cn

找不到类,的解决办法:Didn't find class "cn

作者: 陈科比大宝贝儿 | 来源:发表于2017-08-01 10:12 被阅读0次
    1、Didn't find class "cn.handtv.now.handtv.view.activity.SplashActivity" on path: DexPathList[[zip file "/data/app/cn.handtv.now.handtv-1.apk"],nativeLibraryDirectories=[/data/app-lib/cn.handtv.now.handtv-1, /vendor/lib, /system/lib]]
    
    2、找不到类,java.lang.NoClassDefFoundError:uk.co.senab.photoview.PhotoViewAttacher
    

    今天遇到了这样的Bug,5.0以上的手机没报错,4.4和4.3手机报错,
    上网查了很多的方法都没有解决问题,比如:http://gundumw100.iteye.com/blog/2096013是因为Jar包问题的。
    后来想了想是因为自己又依赖了一些框架,可能是方法数过多,在一个dex包中的函数方法超过了65535个。于是就按照这个原因改了改,成功解决。

    第一步:

     defaultConfig {
            multiDexEnabled true
        }
    

    第二步:

     compile 'com.android.support:multidex:1.0.0'
    

    第三步:

    自己的Application继承extends android.support.multidex.MultiDexApplication
    然后重写:
     @Override
        protected void attachBaseContext(Context base) {
            super.attachBaseContext(base);
            MultiDex.install(this);
        }
    

    相关文章

      网友评论

          本文标题:找不到类,的解决办法:Didn't find class "cn

          本文链接:https://www.haomeiwen.com/subject/lmzdlxtx.html