0

After upgrading Android Gradle plugin to version 3.3.0 in one of my projects, I got several new warnings during syncing the project. Unfortunately, I have no idea how to tackle one of them. The warning is:

WARNING: API 'variant.getGenerateBuildConfig()' is obsolete and has been replaced with 'variant.getGenerateBuildConfigProvider()'. 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.getGenerateBuildConfig(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.

The code line, which causes the warning is: variant.generateBuildConfig.appPackageName in one of my gradle files.

My question is, how should I use new Varaint API's method getGenerateBuildConfigProvider() to retrieve appPackageName? I've tried to look for docs for the API and I've also checked the link from the warning, but, sadly, I haven't found any useful information.

Łukasz Fijas
  • 113
  • 1
  • 8
  • `variant.getGenerateBuildConfigProvider().configure{ gbc -> println "===" + gbc.appPackageName }` musisz pamiętać, że dostęp do tej zmiennej masz tylko w środku closure/action ... jak byś podał więcej szczegółów to pewnie lepsze rozwiązanie by się znalazło – Selvin Jan 16 '19 at 16:35

2 Answers2

1

use variant.getGenerateBuildConfigProvider().get().appPackageName to get the package name

dangVarmit
  • 5,641
  • 2
  • 22
  • 24
-2

I guess,this link will solve your problem.API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()

Kindly check for the dependencies,replace 'compile' or 'APi' to 'implementation',Use 'implementation' it will solve your warnings.

  • *I guess,this link will solve your problem* no, it will not ... if you would read the question from link you would know that it is prblem inside 3rd party plugin/script not it own – Selvin Jan 16 '19 at 12:47