API 'variant.getJavaCompile()' is obsolete

Update: It seems like this is a bug in kotlin plugins which mentioned in here

However, using new release of kotlin plugin (When kotlin started using the new APIs) might get rid of the error as stated in here:

https://github.com/JetBrains/kotlin/pull/1884/commits/1a17cb54a775ab3e55db66109cb12b7d54fbba6c

And: https://github.com/JetBrains/kotlin/pull/1884

The commit was actually for the fix of this issue:

This commit does not change anything functionally, it is only to avoid the warning message, as reporter in https://issuetracker.google.com/116198439


After a deep search into codes, seems like getJavaCompile() is obsolete in your current gradle (alpha11 version). However, you were using alpha version of gradle which I don't really recommend that.

Instead, try using the stable versions like:

classpath 'com.android.tools.build:gradle:3.1.4'

And then warning should be gone I hope.


This warning is related to the Kotlin plugins still using the older (deprecated) APIs.

Please check the below issue on Google issue tracker:
https://issuetracker.google.com/issues/116198439

Duplicate issue with some more info:
https://issuetracker.google.com/issues/116148147

It will be fixed when Kotlin plugin will start using the newer APIs. Please check the issues here:
https://youtrack.jetbrains.com/issue/KT-25428
https://github.com/JetBrains/kotlin/pull/1884