android - java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/graphics/ColorUtils; -
java.lang.noclassdeffounderror
in android 5.1.1
got running on 6.0.1
here class have error:
public class duelstextview extends appcompattextview { int fonttype; public duelstextview(context context) { super(context); init(null); } public duelstextview(context context, attributeset attrs) { super(context, attrs); init(attrs); } public duelstextview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); init(attrs); } public void init(attributeset attrs) { if (attrs != null) { typedarray = getcontext().obtainstyledattributes(attrs, r.styleable.duelstextview); fonttype = a.getinteger(r.styleable.duelstextview_font_type, 0); } try { typeface mytypeface = null; if (fonttype == 0) { mytypeface = typeface.createfromasset(getcontext().getassets(), "fonts/breeserif-regular.ttf"); } else if (fonttype == 1) { mytypeface = typeface.createfromasset(getcontext().getassets(), "fonts/markoone-regular.ttf"); } this.settypeface(mytypeface); } catch (exception e) { e.printstacktrace(); } } }
here gradle file:
apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion '25.0.0' defaultconfig { applicationid "com.adamvarhegyi.duelsofcodrer" minsdkversion 17 targetsdkversion 25 versioncode 1 versionname "1.0" vectordrawables.usesupportlibrary = true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavencentral() } dependencies { compile filetree(include: ['*.jar'], dir: 'libs') compile('com.android.support:appcompat-v7:25.0.1') { exclude module: 'support-v4' } compile('com.android.support:recyclerview-v7:25.0.1') compile('com.makeramen:roundedimageview:2.2.1') compile('org.apache.commons:commons-lang3:3.4') compile('de.hdodenhof:circleimageview:2.1.0') }
if change extending simple textview
it's working fine, android studio suggests me have use appcompattextview
custom views.
why happening? should modify?
change these dependencies
compile('com.android.support:appcompat-v7:25.0.1') { exclude module: 'support-v4' } compile('com.android.support:recyclerview-v7:25.0.1')
to
compile('com.android.support:appcompat-v7:25.0.0') compile('com.android.support:recyclerview-v7:25.0.0')
don't know why exclude v4, if it's not reason keep it.
don't know why happening, happened me , fix match buildtoolsversion
support libraries version.
Comments
Post a Comment