运行flutter app报错WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'varia

运行flutter app报错WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'. 

新建第一个flutter项目运行时报错提示getJavaCompile方法过期,提示如下:

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

但是我项目里面没有用到这个方法,百度上说了很多问题,想什么gradle版本不对,同步下载不了依赖库,要改镜像下载啥的,都试了,都没用,最后在stackoverflow看到一个回答:

https://stackoverflow.com/questions/52470044/warning-api-variant-getjavacompile-is-obsolete-and-has-been-replaced-with?r=SearchResults

后面有一个回答是提到Kotlin版本问题,将Kotlin版本由1.2.71升级到1.3.50就可以了,按照他的回答,升级Kotlin后果然可以正常运行了。

 

运行flutter app报错WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'varia

大家遇到的问题可能不一样,可以看下stackoverflow上面的其他回答