Sta*_*y T -4 java android compiler-errors
我正在尝试从下面的 git 链接运行代码
https://github.com/Mikhail57/RetrofitTutorial
但我收到一个错误
java.lang.NoSuchMethodError:没有静态方法 getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; 在类 Landroid/support/v4/content/res/ResourcesCompat 中;或其超类(“android.support.v4.content.res.ResourcesCompat”的声明出现在 /data/app/com.stanlytango.android.secondfromgitretrofit-aDuaUJp0_br091ehbTa3bQ==/split_lib_dependency_apk.apk 中)
我的应用程序 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.stanlytango.android.secondfromgitretrofit"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.google.code.gson:gson:2.8.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
}
Run Code Online (Sandbox Code Playgroud)
活动_主布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.stanlytango.android.secondfromgitretrofit.MainActivity">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:id="@+id/posts_recycle_view"
android:layout_alignParentStart="true" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
请任何人都可以帮我解决它。多谢!
用这个
compileSdkVersion 27.0.2
buildToolsVersion '27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
Run Code Online (Sandbox Code Playgroud)
而不是这个
compileSdkVersion 26
implementation 'com.android.support:appcompat-v7:26.1.0'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8048 次 |
| 最近记录: |