java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/Typed

Yesterday was fine, but today I reported an error. After Baidu Google, this error is very good in java, but I modified the project developed by kolin a little more! Not much to say, first on the full error code

java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support4/content/res/ResourcesCompat; or its super classes (declaration of ‘android.support.v4.content.res.ResourcesCompat’ appears in /data/app/rundi.investment-2/base.apk:classes4.dex)

java solution

The compiled version and the version number under build must be the same, I use sdk27
compileSdkVersion 27
buildToolsVersion '27.0.3'
minSdkVersion 16
targetSdkVersion 27

implementation ‘com.android.support:design:27.1.1’
implementation ‘com.android.support:support-v4:27.1.1’
implementation ‘com.android.support:cardview-v7:27.1.1’
implementation ‘com.android.support:gridlayout-v7:27.1.1’
implementation ‘com.android.support:recyclerview-v7:27.1.1’

For the java code, the above can be solved (my Baidu google is such an answer) Now I will talk about kotlin

kotlin solution

I used sdk26 before, and it was the same as the above, but it still reported an error, and I kept looking for it and finally got no results!
If it is kotlin code, you must not only be consistent but also modify the code, because kotlin has been upgraded all the time, if you upgrade the sdk, kotlin also needs to change
it. Modify the code that loaded the layout before
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
mView = inflater.inflate(R.layout.fragment_expert_detail,container,false)
return mView
}

I upgraded the sdk to the 27 compiled version as above, but after the compilation is completed, I will find that many pages report errors. For mine, all the layouts are loaded with errors. The
solution is to
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? {
mView = inflater.inflate(R.layout.fragment_expert_detail,container,false)
return mView
}

Nullable symbols? This method will not be modified during the modification process by removing it, but it is all a problem of symbols. I wish you no bugs in your code

In order to facilitate communication and common learning, the blogger QQ group 543671130 (Android learning exchange) welcomes criticism and guidance

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324540501&siteId=291194637