I updated to AndroidStudio 3.3 which now gives a warning about deprecated libraries:
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'. It will be removed at the end of 2019. For more information, see https://d.android.com/r/tools/task-configuration-avoidance. To determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace. Affected Modules: app
There is some more info provided at their web site:
https://developer.android.com/studio/releases/gradle-plugin?utm_source=android-studio#behavior_changes
but I don't exactly understand it. They say:
To see the additional info, you need to include the following in your project's gradle.properties file:
android.debug.obsoleteApi=true
So I took the build.gradle that is marked with (Project: [my project])
The document looks like this:
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://jitpack.io"
}
mavenCentral()
}
}
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin" == plugin.class.name) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin" == plugin.class.name) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
}
repositories {
mavenCentral()
}
However, I don't understand, where I should add that line now. And no matter where I put it, I always get an error.
E.g. when writing it directly in the first line:
Could not get unknown property 'android' for root project [my project] of type org.gradle.api.Project.
So where is this supposed to be added? Or am I mixing the definitions of "Project" and "app" for the gradle files?
You need to put it in gradle.properties
file which is present at the project level, outside of the app folder not in build.gradle
file which you are currently trying to do.
From the android developer documentation
Better debug info when using obsolete API: When the plugin detects that you're using an API that's no longer supported, it can now provide more-detailed information to help you determine where that API is being used. To see the additional info, you need to include the following in your project's gradle.properties file:
android.debug.obsoleteApi=true
You can also enable the flag by passing -Pandroid.debug.obsoleteApi=true from the command line.
You can check this Link.
The easiest way is do it in the terminal at the root of the android project.
Run the following command:
./gradlew -Pandroid.debug.obsoleteApi=true
As stated in the error message, you should add that in gradle.properties
file and not in any of your build.gradle
files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With