JakeWharton / butterknife

Bind Android views and callbacks to fields and methods.
http://jakewharton.github.io/butterknife/
Apache License 2.0
25.55k stars 4.6k forks source link

java.lang.NoSuchMethodError in Android Studio3.0 #1129

Closed zf530820145 closed 7 years ago

zf530820145 commented 7 years ago

i have some question. Yesterday my project was running normally,but today my project have some problem.Throw java.lang.NoSuchMethodError.I fixed it when i use this method. compile('com.jakewharton:butterknife:9.0.0-SNAPSHOT') { exclude module: 'appcompat-v7' exclude group: 'com.android.support' }.What's probleam?

JakeWharton commented 7 years ago

You haven't provided enough information to diagnose a problem. How about a full stacktrace to start.

zf530820145 commented 7 years ago

this is the full stacktrace:

java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.globalegrow.app.gearbest-1/base.apk:classes28.dex)
W:     at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119)
W:     at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208)
W:     at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:110)
W:     at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38)
W:     at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:81)
W:     at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:71)
W:     at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
W:     at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024)
W:     at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081)
W:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
W:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
W:     at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
W:     at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
W:     at android.view.LayoutInflater.inflate(LayoutInflater.java:365)

i fixed this error by add this { exclude module: 'appcompat-v7' exclude group: 'com.android.support' } in build.gradle, but i dont know why? Can u explain it?

JakeWharton commented 7 years ago

Don't do that. You should depend on version 27.0.0 of the support libraries to use the latest version of Butter Knife.