Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new Android Gradle Plugin 3.3+ APIs: WARNING: API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' #942

Closed
sjindong opened this issue Jan 28, 2019 · 23 comments
Assignees
Milestone

Comments

@sjindong
Copy link

sjindong commented Jan 28, 2019

Edit: see workaround below.


when i compile the version with 'org.greenrobot:greendao-gradle-plugin:3.2.2' ,i get an error :
WARNING: API 'variant.getJavaCompiler()' 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.getJavaCompiler(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace. Affected Modules: app

and i try execute a command,gradlew -Pandroid.debug.obsoleteApi=true, i get :
`>gradlew -Pandroid.debug.obsoleteApi=true

Configure project :app
WARNING: API 'variant.getJavaCompiler()' 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.
REASON: It is currently called from the following trace:
java.lang.Thread.getStackTrace(Thread.java:1552)
com.android.build.gradle.internal.errors.DeprecationReporterImpl.reportDeprecatedApi(DeprecationReporterImpl.kt:79)
com.android.build.gradle.internal.api.BaseVariantImpl.getJavaCompiler(BaseVariantImpl.java:447)
com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated.getJavaCompiler(null:-1)
org.greenrobot.greendao.gradle.AndroidPluginSourceProvider.addGeneratorTask(SourceProvider.kt:62)
org.greenrobot.greendao.gradle.AndroidPluginSourceProvider$addGeneratorTask$1.execute(SourceProvider.kt:46)
org.greenrobot.greendao.gradle.AndroidPluginSourceProvider$addGeneratorTask$1.execute(SourceProvider.kt:27)
org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:158)
org.greenrobot.greendao.gradle.AndroidPluginSourceProvider.addGeneratorTask(SourceProvider.kt:45)
org.greenrobot.greendao.gradle.Greendao3GradlePlugin$apply$1.execute(Greendao3GradlePlugin.kt:50)
org.greenrobot.greendao.gradle.Greendao3GradlePlugin$apply$1.execute(Greendao3GradlePlugin.kt:14)
org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction$1$1.run(DefaultListenerBuildOperationDecorator.java:155)
... ...
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
java.lang.Thread.run(Thread.java:745)

WARNING: Debugging obsolete API calls can take time during configuration. It's recommended to not keep it on at all times.`

Although this problem will break out in 2020, I hope to solve it in the next version as soon as possible.

@sjindong
Copy link
Author

I also posted this question on stackoverflow.com . This Problem

@greenrobot-team
Copy link
Collaborator

greenrobot-team commented Jan 28, 2019

Thanks for reporting. This is due to an API change in Android Gradle Plugin 3.3.0.

However, for now everything should work fine. This is just a warning (It will be removed at the end of 2019.).

Task: support Android Gradle Plugin 3.3.0 API changes.
-ut

@wutong751
Copy link

I had the same problem

@LuigiMaestrelli
Copy link

So, you will wait until the build breaks to fix it?

@liaopen123
Copy link

how do you fixed it?

@wzp09tjlg
Copy link

I had the same problem,how do you fixed it?

@LLLiuWeiJian
Copy link

+11111111111111

@sjindong
Copy link
Author

@wutong751 @LuigiMaestrelli @liaopen123 @wzp09tjlg @LLLiuWeiJian
行了 直接说中文吧, 除了等官方更新,不然怎么办。最起码今年年底前 这个问题毫无影响,除了有个warning

Yes,just wait,At least until the end of 19 years, this is just a warning and does not affect compilation.

@sjindong sjindong reopened this Apr 23, 2019
@lizhw123
Copy link

@greenrobot-team When do you plan to solve this problem?

@wutong751
Copy link

@wutong751 @LuigiMaestrelli @liaopen123 @wzp09tjlg @LLLiuWeiJian
行了 直接说中文吧, 除了等官方更新,不然怎么办。最起码今年年底前 这个问题毫无影响,除了有个warning

Yes,just wait,At least until the end of 19 years, this is just a warning and does not affect compilation.

好吧

@greenrobot-team
Copy link
Collaborator

When do you plan to solve this problem?

I can't promise anything, but hopefully when we have time.

@sjindong
Copy link
Author

@greenrobot-team so, can i help your team ? just the part of gradle. if yes, i will start action

@WindRush
Copy link

it make my layout resources shows error
86480819-B75F-4D55-AF87-381DD74CCBCE

so when do you plan to solve this

Repository owner deleted a comment from WindRush Jun 18, 2019
@greenrobot-team greenrobot-team changed the title i use greenDAO and get an error: WARNING: API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'. Support Android Gradle Plugin 3.3+: WARNING: API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Jun 18, 2019
@greenrobot-team greenrobot-team changed the title Support Android Gradle Plugin 3.3+: WARNING: API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Use new Android Gradle Plugin 3.3+ APIs: WARNING: API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Jun 18, 2019
@heinzan
Copy link

heinzan commented Jun 20, 2019

I had the same problem.When time fix?

1 similar comment
@zytq
Copy link

zytq commented Jun 20, 2019

I had the same problem.When time fix?

@mesterj
Copy link

mesterj commented Jun 27, 2019

+1

2 similar comments
@xiaoyifan6
Copy link

+1

@hookbin
Copy link

hookbin commented Jul 2, 2019

+1

@greenrobot-team
Copy link
Collaborator

greenrobot-team commented Jul 16, 2019

Update: you can work around the warning by removing the targetGenDir property from the greendao configuration in your build.gradle file.

greendao {
    schemaVersion 2
    targetGenDir "/my/special/directory" <-- Remove this.
}

This will generate greenDAO files into the build folder instead of a custom directory when building the project. So make sure to delete the duplicate files from your old targetGenDir.
http://greenrobot.org/greendao/documentation/modelling-entities/#Schema

Anyhow, this issue was fixed internally and will be available with the next update.

@LiLustre
Copy link

When will it be updated?

Repository owner deleted a comment from checkming Sep 3, 2019
Repository owner deleted a comment from chengfan2017 Sep 23, 2019
Repository owner deleted a comment from chengfan2017 Sep 23, 2019
@yalamo
Copy link

yalamo commented Dec 26, 2019

(variant.getJavaCompiler() ) Now It will be removed in few days, what shoud i do?

@cf-wu
Copy link

cf-wu commented Dec 30, 2019

(variant.getJavaCompiler() ) Now It will be removed in one day, what shoud i do?

@Aima09
Copy link

Aima09 commented Jan 6, 2020

Update: you can work around the warning by removing the targetGenDir property from the greendao configuration in your build.gradle file.

greendao {
    schemaVersion 2
    targetGenDir "/my/special/directory" <-- Remove this.
}

This will generate greenDAO files into the build folder instead of a custom directory when building the project. So make sure to delete the duplicate files from your old targetGenDir.
http://greenrobot.org/greendao/documentation/modelling-entities/#Schema

Anyhow, this issue was fixed internally and will be available with the next update.

not works with this answers for now

@greenrobot-team greenrobot-team modified the milestones: 3.x, 3.3.0 Feb 18, 2020
@greenrobot-team greenrobot-team pinned this issue Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests