I am currently using Android Studio 3.3 Canary 11 along with the gradle plugin version 3.3.0-alpha11. While syncing my gradle, I encounter a deprecation warning that states:
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been
replaced with 'variant.getExternalNativeBuildProviders()'.
It will no longer be available after 2019.
Affected Modules: app
This warning is associated with the following section of my app’s build.gradle file:
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${variant.name}-${variant.versionName}.apk"
}
}
Here’s a brief overview of my main build.gradle configuration:
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha11'
classpath "io.realm:realm-gradle-plugin:4.1.1"
classpath 'com.google.gms:google-services:3.2.1'
}
}
ext {
minSdkVersion = 21
targetSdkVersion = 27
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
supportLibraryVersion = '27.1.1'
}
Also, here’s how my app module build.gradle looks like:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.myapp.example"
minSdkVersion rootProject.ext.minSdkVersion
multiDexEnabled true
versionCode appVersionCode
versionName appVersionName
}
buildTypes {
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${variant.name}-${variant.versionName}.apk"
}
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
debuggable true
versionNameSuffix '-DEBUG'
}
}
}
What modifications should I make to address this deprecation issue? Can you guide me on how to correctly implement the newer API?