书法库上的NoClassDefFoundError [英] NoClassDefFoundError on Calligraphy library

查看:71
本文介绍了书法库上的NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将compile 'com.android.support:support-v13:21.0.+'添加到build.gradle之后,在构建应用程序时遇到了一些冲突,因此我不得不在build.gradle内的defaultConfig中添加 multiDexEnabled = true .那些冲突已经消失了,但是对于丢失的书法库,我遇到了另一个例外(打开应用程序时):

After adding compile 'com.android.support:support-v13:21.0.+' to build.gradle, I had some conflicts on building my app, so I had to add multiDexEnabled = true to defaultConfig inside build.gradle. Those conflict are gone, but i got another exception (on opening the app) for the missing calligraphy library:

java.lang.NoClassDefFoundError: uk.co.chrisjenx.calligraphy.R$attr
        at uk.co.chrisjenx.calligraphy.CalligraphyConfig$Builder.<init>(CalligraphyConfig.java:150)
        at com.taxiyaab.android.util.ApplicationClass.onCreate(ApplicationClass.java:120)
        at newapp.com.taxiyaab.taxiyaab.PassengerApplication.onCreate(PassengerApplication.java:68)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4462)
        at android.app.ActivityThread.access$1500(ActivityThread.java:144)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1306)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:212)
        at android.app.ActivityThread.main(ActivityThread.java:5135)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
        at dalvik.system.NativeStart.main(Native Method)

我最新的sdk构建工具版本是22.0.1.有人遇到过这个问题吗?

My latest sdk build tools version is 22.0.1. Has anybody faced this issue before?

推荐答案

如果您支持21以下的API级别,则您的Application类应从支持库扩展MultiDexApplication.

If you support API levels under 21, your Application class should extend MultiDexApplication from the support library.

class MyApplication extends MultiDexApplication

如果您没有自定义的Application类,则应将MultiDexApplication类直接添加到清单中

If you do not have a custom Application class, than you should add the MultiDexApplication class to your manifest directly

<application
    android:name="android.support.multidex.MultiDexApplication">
</application>

请参见 https://developer.android.com/tools/building/multidex.html

这篇关于书法库上的NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆