configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support' && !requested.name.startsWith("multidex")) {
details.useVersion "28.0.0"
}
if (requested.group == 'androidx.appcompat' && !requested.name.startsWith("multidex")) {
details.useVersion "1.0.0"
}
if (requested.group == 'androidx.core' && !requested.name.startsWith("multidex")) {
details.useVersion "1.0.0"
}
}
}
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
android.enableJetifier=true
android.useAndroidX=true
现在,您应该能够在 Android Studio 中正确显示 gradle 项目了。