Gradle obsolete raise an error instead of a warning - android

When using com.android.tools.build:gradle:3.3.0-beta01, gradle fail with:
ERROR: 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.
I search in the documentation but I don't find how to raise warning, not error. End of 2019 is not here yet.

It happened to me and the problem was solved by commenting on the Fabric plugin in gradle.
If your case is the same but you need to continue using the Fabric, I recommend going back to the to the previous version of the gradle at the project level.
Change the classpath version to com.android.tools.build:gradle:3.2.1.

Related

WARNING: API 'variant.getMappingFile()' is obsolete and has been replaced with 'variant.getMappingFileProvider()'

I just updated Android Studio 3.5 to Android Studio 3.6 and replaced previous Gradle plugin with Gradle plugin 3.6.0 when syncing Gradle:
build.gradle: API 'variant.getMappingFile()' is obsolete and has been
replaced with 'variant.getMappingFileProvider()'
Any suggestions on how to debug this warning. Where is it coming from? I don't see any usage of getMappingFile in my code although, might be some library. Suggestions to debug these kind of cases would be helpful
Upgrading
classpath 'io.fabric.tools:gradle:1.29.0'
to
classpath 'io.fabric.tools:gradle:1.31.2'
in my top-level build.gradle fixed the problem for me.
When running the gradle script with the parameter -Pandroid.debug.obsoleteApi=true set, you can get a stack trace of what is causing the issue.
I found out it in my case was related to Crashlytics. There was this issue opened, but it's apparently the legacy-plugin so the issue has been closed again with a suggestion of contacting the Fabric support. So hopefully they will find a solution.
Go to build.gradle under Gradle Scripts
Add this Line: classpath 'io.fabric.tools:gradle:1.31.2'
Rebuild your Project.
If your project uses Firebase: instead of upgrading io.fabric.tools:gradle version it's better to switch to com.google.firebase:firebase-crashlytics-gradle since fabric is deprecated now. See Upgrade to the Firebase Crashlytics SDK guide for detailed instructions.
Maybe it could be of help to someone. In my case, it was:
variant.mappingFile
which was used in build.gradle to backup mapping files. To remove the warning use:
variant.mappingFileProvider

Android Gradle Plugin (Warning) API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'

I am trying to build and run this repository augmented-images
and I encounted this error.
Caused by: java.lang.RuntimeException: Error creating sfa.
Which drill down to this warning Warning ! API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.
More from the build log analysis I see the following errors
ERROR: Failed to import 'sampledata/airplane/Airplane.obj'
I tried to find where this
variant.getMergeResources()
is used so I can replace it but no luck.
Please assist maybe I need to update the plugin. Which steps should I follow that is what I suspect will be the solution.
Changing classpath 'com.google.gms:google-services:4.3.0' to classpath 'com.google.gms:google-services:4.2.0' works for now..
Now it is fixed with the release 'com.google.gms:google-services:4.3.2'
This issue is caused by the versions of the Google Services pluigin for gradle 4.3.0 and 4.3.1.

Android studio3.3 variantOutput.getProcessResources() is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()

What is bellow warning:
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
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 variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
Affected Modules: app
It's the bug in https://services.gradle.org/distributions/gradle-4.10.1-all.zip .
You need to roll back to https://services.gradle.org/distributions/gradle-4.6-all.zip in gradle-wrapper.properties
And
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' //roll back to this version
I have deal with this bug for 4 hours. I gave up so I rolled back to last version. It's perfect now. So let's wait for the newer version. Don't upgrade, yet!
run a gradle task with this flag -Pandroid.debug.obsoleteApi=true
and it will let you know where the obsolete feature is being used.
After identifying where the issue is, you can try updating as the message suggests
ex. .gradlew app:assembleDebug -Pandroid.debug.obsoleteApi=true
I do not need to change the default of " classpath 'com.google.gms:google-services:4.2.0' ". This is the default that I copy from firebase, it really has been updated but we do not need to update it.

Migrate an old project to Android Studio

I am new to Android Studio.
need to Migrate an old project to Android Studio
First I got this error :
android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor'..
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information ...
Then when I make the changes and replace what i need to i get this error:
'keyboard|screenSize|orientation|' is incompatible with ...
anyone having idea about this please help
For the android-apt error refer:
Incompatible plugins for android-apt after upgrading to Android Studio 2.3
Also, in your app gradle file, under dependencies section, change compile to implementation. (compile will be deprecated at the end of 2018, you should use implementation instead).
For the second one, it seems like (according to the image) that you have an extra | at the end (keyboard|screenSize|orientation|) try to remove it.
Next time please attach the code itself, it will be much easier to find what's wrong.

Android Studio and Gradle - seemingly misleading warning regarding testCompile, testImplementation, testApi

I get these two lines when compiling an old Android project using latest Android Studio (3.1.4):
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
I understand what they mean and how I can fix these warnings, there are also questions explaining it, but I can't any reference to 'testApi' anywhere on developer.android.com. Is it an error in warnings or was there testApi command? Was it added alongside 'testImplementation' and was later deprecated?
Previously we used testCompile but as per the last Gradle update Android Studio sometimes shows this messages though we edit the gradle file with new keywords.Now the "testApi" was not there in gradle as per my own experience.I think this error message is a fault.

Categories

Resources