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?
output.outputFile.parent
=>variant.getPackageApplicationProvider().get().outputs.files[1]
.... google should fix it because the problem isoutput.outputFile
it's internally callinggetPackageApplication()
– Kelleykellivariant.getExternalNativeBuildTasks()
is obsolete... which would need to be replaced withvariant.getExternalNativeBuildProviders()
– Polervariant.getExternalNativeBuildProviders()
this comes from .... let me guess ... io.fabric plugin ... – Kelleykellicom.crashlytics.tools.gradle.ProjectVariantState.resolveDebugNativeLibsPath(ProjectVariantState.groovy:130)
. add the comment as an answer and I'd accept it, because it answers the primary question. – PolerregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
fromcom.google.gms.google-services
... I give up with this ... I spent 2 days analyzing those warnings – Kelleykellivariant.getPackageApplicationProvider().get().outputs.files[1]
doesnt looks good ... alsovariant.getPackageApplicationProvider().get().outputs.files[0]
points tobuild\intermediates\incremental\packageVariant1Varian2...
... what if Google change 0 with 1 in next release? ... there should be easy way to get path to apk from either assemble or package task – Kelleykelliandroid.enableSeparateAnnotationProcessing = true
fixes one incremental annotation processor warning forRoom
. – PoleroutputFile
objects no longer work. That's because variant-specific tasks are no longer created during the configuration stage. This results in the plugin not knowing all of its outputs up front, but it also means faster configuration times." – PolerregisterResGeneratingTask()
. – Poler