2 m0 38074457 m0_38074457 于 2017.09.07 11:02 提问

super.onCreate 报 NoSuchMethodError 20C

Process: com.sunskym, PID: 15284
java.lang.NoSuchMethodError: No static method getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable; in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/data/com.sunskym/files/instant-run/dex/slice-qssdk_dea80f4e7c3646ad9ed2d551a6c67de7e91fdebc-classes.dex)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:201)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:189)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:710)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:194)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.(AppCompatDelegateImplBase.java:129)
at android.support.v7.app.AppCompatDelegateImplV9.(AppCompatDelegateImplV9.java:152)
at android.support.v7.app.AppCompatDelegateImplV11.(AppCompatDelegateImplV11.java:29)
at android.support.v7.app.AppCompatDelegateImplV14.(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegateImplV23.(AppCompatDelegateImplV23.java:31)
at android.support.v7.app.AppCompatDelegateImplN.(AppCompatDelegateImplN.java:31)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:200)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:184)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:518)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:70)
at com.sunskym.view.activity.LoginActivity.onCreate(LoginActivity.java:42)
at android.app.Activity.performCreate(Activity.java:6910)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)

我再libs文件夹中添加一个jar包之后就报这种错误
图片说明 这个jar报中含有v4包,应该是版本太低的问题,如何解决?

2个回答

qq_38494537
qq_38494537   2017.09.07 11:05
a22422931
a22422931   2017.09.07 15:38

compile('com.android.support:recyclerview-v7:23.4.0') {
exclude module: 'support-v4'
}
你应该是v4冲突了。 因为v7中包含着v4。

Csdn user default icon
上传中...
上传图片
插入图片