报错修改:Failed to query the value of task 'xx:compileDebugJavaWithJavac' property 'options.generated...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lib-sample:compileDebugJavaWithJavac'.
> Failed to query the value of task ':lib-sample:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
   > Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /Users/name/AndroidStudioProjects/Myproject/lib-sample/build/generated/ap_generated_sources/debug/out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@d9db944) before task ':lib-sample:compileDebugJavaWithJavac' has completed is not supported
* Try:

发生这个错误的原因一般是build.gradleclasspathgradle文件夹下gradle-wrapper.properties文件里的distributionUrl配置不匹配,所以修改的方式有两种,一种是修改distributionUrl

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

另外一种是修改build.gradle中的gradle版本

classpath "com.android.tools.build:gradle:4.0.1"
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容