The option setting android defaults buildfeatures buildconfig true is deprecated

В Android Studio при запуске приложения возникает следующая ошибка

The option setting ‘android.defaults.buildfeatures.buildconfig=true’ is deprecated.
The current default is ‘false’.
It will be removed in version 9.0 of the Android Gradle plugin.
You can resolve this warning in Android Studio via Refactor > Migrate BuildConfig to Gradle Build Files

 

Failed to resolve: com.android.support:support-annotations:28.0.0
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app

The option setting ‘android.defaults.buildfeatures.buildconfig=true’ is deprecated.
:app:checkDebugAarMetadata
:app:mapDebugSourceSetPaths
:app:mergeDebugResources
:app:processDebugMainManifest
:app:mergeDebugAssets
:app:mergeDebugJavaResource
:app:checkDebugDuplicateClasses
:app:desugarDebugFileDependencies
:app:mergeDebugNativeLibs
:app:writeDebugSigningConfigVersions
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:support-annotations:28.0.0.
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:support-annotations:28.0.0.
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:support-annotations:28.0.0.
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ ArtifactResolveException: Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:support-annotations:28.0.0.
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ ArtifactResolveException: Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:support-annotations:28.0.0.
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ ArtifactResolveException: Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:support-annotations:28.0.0.
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ ArtifactResolveException: Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:support-annotations:28.0.0.
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ ArtifactResolveException: Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:support-annotations:28.0.0.
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ ArtifactResolveException: Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:support-annotations:28.0.0.

Итак, исправляем ошибку

В файле gradle.properties указываем

android.defaults.buildfeatures.buildconfig=true

Далее переходим Refactor -> Migrate BuildConfig to Gradle Build Files

Migrate BuildConfig to Gradle Build Files

и ниже жмём Do Refactor

Do Refactor

В файле build.gradle 

buildFeatures{
buildConfig true
}
249

Leave a Reply

Ваш адрес email не будет опубликован.