with Gradle 4.10.1
and the Android Gradle plugin updated to 3.3.0
, I get the following warning:
WARNING: API '
variantOutput.getPackageApplication()
' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()
'.
the line, with the surrounding context (which is assigning output file-names by build variant):
applicationVariants.all { variant ->
variant.outputs.all { output ->
if (variant.getBuildType().getName() in rootProject.archiveBuildTypes) {
def buildType = variant.getBuildType().getName()
if (variant.versionName != null) {
def baseName = output.baseName.toLowerCase()
String fileName = "${rootProject.name}_${variant.versionName}-${baseName}.apk"
// this is the line:
outputFileName = new File(output.outputFile.parent, fileName).getName()
}
}
}
}
the migration guide isn't too helpful; while the variant.outputs.all
might be at fault - just have no clue with what to replace that - and the migration guide refers to tasks and not to build variants. when disabling File → Settings → Experimental → Gradle → Only sync the active variant
, I get even more deprecation warnings (the point is, that none of these methods are being called directly):
WARNING: API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
WARNING: API 'variantOutput.getProcessManifest()' is obsolete and has been replaced with 'variantOutput.getProcessManifestProvider()'.
WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
WARNING: API 'variant.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
WARNING: API 'variantOutput.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.
Q: how can these deprecation warnings be avoided by migration to the new API?
WARNING: API ' variantOutput.getPackageApplication () ' is obsolete and has been replaced with ' variant.getPackageApplicationProvider () '. the line, with the surrounding context (which is assigning output file-names by build variant):
WARNING: API 'variantOutput.getProcessManifest ()' is obsolete and has been replaced with 'variantOutput.getProcessManifestProvider ()'. WARNING: API 'variant.getMergeResources ()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider ()'.
WARNING: API 'variantOutput.getProcessResources ()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider ()'. WARNING: API 'variantOutput.getProcessManifest ()' is obsolete and has been replaced with 'variantOutput.getProcessManifestProvider ()'.
After upgrading 'Android Gradle plugin' to 3.4.0, I have got a warning message in /app/build.gradle WARNING: API 'variantOutput.getPackageApplication ()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider ()'.
variantOutput.getPackageApplication() is being caused by a changed variant API.
changing
output.outputFile.parent
tovariant.getPackageApplicationProvider().get().outputs.files[1]
is at least a temporary workaround.
source: @Selvin.
variant.getExternalNativeBuildTasks() is being caused by the io.fabric
plugin.
the next version of the
io.fabric
plugin will usevariant.getExternalNativeBuildProviders()
.
source: 116408637; the confirmation for a promised fix (1.28.1
).
These are caused by com.google.gms.google-services
:
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'
This blog post explains how to get rid of the com.google.gms.google-services
plugin altogether, by adding the XML resources, which that plugin generates, eg. from build/generated/res/google-services/debug/values/values.xml
into the regular debug/values/values.xml
.
The most easy and the least effort might be:
buildscript {
repositories {
google()
maven { url "https://maven.fabric.io/public" }
}
dependencies {
//noinspection GradleDependency
classpath "com.android.tools.build:gradle:3.2.1"
classpath "io.fabric.tools:gradle:1.28.1"
}
}
For debug information: ./gradlew -Pandroid.debug.obsoleteApi=true mobile:assembleDebug
None of these warnings
changes the behavior in any way.
Update Fabric gradle plugin to 1.28.1
dependencies {
classpath 'io.fabric.tools:gradle:1.28.1'
}
Changelog: https://docs.fabric.io/android/changelog.html#march-15-2019
Eliminated obsolete API warnings by switching to Gradle’s task configuration avoidance APIs, when available.
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