需求背景
最近在使用android studio导入hbuilder的HBuilder-Integrate-AS工程时候报错,错误消息如下两种。
错误描述
第一种
Failed to notify dependency resolution listener.
‘void org.gradle.api.artifacts.DependencySubstitutions$Substitution.with(org.gradle.api.artifacts.component.ComponentSelector)’
第二种
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
第三种
HBuilder-Integrate-AS\gradle\wrapper\gradle-wrapper.properties文件里面默认的distributionUrl是6.5.all.zip,或者你导入别的项目,这个url直接连接不到,无法下载。
这个文件拉取直接就是connect filed
第四种
Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not “opens java.io” to unnamed module @56b5d372
Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @56b5d372
解决方法
拒绝连接可以修改别的gradle的版本,不要直接修改文件,在android studio工具里面修改。
以上的报错都是gradle版本和JDK版本不一致导致的。我这里下载了7.3版本,编译成功。
经过测试===================gradle7.3+jdk11================OK
经过测试===================gradle7.2+jdk11================OK
gradle7+jdk17编译通过无法启动,启动报错。
JDK和Gradle版本对应如下
操作方法
1、修改JDK版本
必须先修改JDK版本,因为修改了Gradle版本,系统会自动重新下载编译。JDK版本参照上图的对应关系。我这里用的JDK17和Gradle 7.3。打开android studio,点击file-Project Structure-SDK Location,然后点击Gradle Settings,然后选择Gradle JDK。
2、修改Gradle版本
打开android studio,点击file-Project Structure-project,然后下拉框修改Gradle Version版本。
结束
—–华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码—–
—–华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码—–
—–华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码—–
package cn.renkai721.bean.vo; import lombok.extern.slf4j.Slf4j; @Slf4jpublic class MakeUpTheWordCount { private String make_up_the_word_count_column_999999999_1;private String make_up_the_word_count_column_999999999_2;private String make_up_the_word_count_column_999999999_3;private String make_up_the_word_count_column_999999999_4;private String make_up_the_word_count_column_999999999_5;private String make_up_the_word_count_column_999999999_6;private String make_up_the_word_count_column_999999999_7;private String make_up_the_word_count_column_999999999_8;private String make_up_the_word_count_column_999999999_9;private String make_up_the_word_count_column_999999999_10;private String make_up_the_word_count_column_999999999_11;private String make_up_the_word_count_column_999999999_12;private String make_up_the_word_count_column_999999999_13;private String make_up_the_word_count_column_999999999_14;private String make_up_the_word_count_column_999999999_15;private String make_up_the_word_count_column_999999999_16;private String make_up_the_word_count_column_999999999_17;private String make_up_the_word_count_column_999999999_18;private String make_up_the_word_count_column_999999999_19;private String make_up_the_word_count_column_999999999_20; public String getMake_up_the_word_count_column_999999999_1() {return make_up_the_word_count_column_999999999_1;} public void setMake_up_the_word_count_column_999999999_1(String make_up_the_word_count_column_999999999_1) {this.make_up_the_word_count_column_999999999_1 = make_up_the_word_count_column_999999999_1;} public String getMake_up_the_word_count_column_999999999_2() {return make_up_the_word_count_column_999999999_2;} public void setMake_up_the_word_count_column_999999999_2(String make_up_the_word_count_column_999999999_2) {this.make_up_the_word_count_column_999999999_2 = make_up_the_word_count_column_999999999_2;} public String getMake_up_the_word_count_column_999999999_3() {return make_up_the_word_count_column_999999999_3;} public void setMake_up_the_word_count_column_999999999_3(String make_up_the_word_count_column_999999999_3) {this.make_up_the_word_count_column_999999999_3 = make_up_the_word_count_column_999999999_3;} public String getMake_up_the_word_count_column_999999999_4() {return make_up_the_word_count_column_999999999_4;} public void setMake_up_the_word_count_column_999999999_4(String make_up_the_word_count_column_999999999_4) {this.make_up_the_word_count_column_999999999_4 = make_up_the_word_count_column_999999999_4;} public String getMake_up_the_word_count_column_999999999_5() {return make_up_the_word_count_column_999999999_5;} public void setMake_up_the_word_count_column_999999999_5(String make_up_the_word_count_column_999999999_5) {this.make_up_the_word_count_column_999999999_5 = make_up_the_word_count_column_999999999_5;} public String getMake_up_the_word_count_column_999999999_6() {return make_up_the_word_count_column_999999999_6;} public void setMake_up_the_word_count_column_999999999_6(String make_up_the_word_count_column_999999999_6) {this.make_up_the_word_count_column_999999999_6 = make_up_the_word_count_column_999999999_6;} public String getMake_up_the_word_count_column_999999999_7() {return make_up_the_word_count_column_999999999_7;} public void setMake_up_the_word_count_column_999999999_7(String make_up_the_word_count_column_999999999_7) {this.make_up_the_word_count_column_999999999_7 = make_up_the_word_count_column_999999999_7;} public String getMake_up_the_word_count_column_999999999_8() {return make_up_the_word_count_column_999999999_8;} public void setMake_up_the_word_count_column_999999999_8(String make_up_the_word_count_column_999999999_8) {this.make_up_the_word_count_column_999999999_8 = make_up_the_word_count_column_999999999_8;} public String getMake_up_the_word_count_column_999999999_9() {return make_up_the_word_count_column_999999999_9;} public void setMake_up_the_word_count_column_999999999_9(String make_up_the_word_count_column_999999999_9) {this.make_up_the_word_count_column_999999999_9 = make_up_the_word_count_column_999999999_9;} public String getMake_up_the_word_count_column_999999999_10() {return make_up_the_word_count_column_999999999_10;} public void setMake_up_the_word_count_column_999999999_10(String make_up_the_word_count_column_999999999_10) {this.make_up_the_word_count_column_999999999_10 = make_up_the_word_count_column_999999999_10;} public String getMake_up_the_word_count_column_999999999_11() {return make_up_the_word_count_column_999999999_11;} public void setMake_up_the_word_count_column_999999999_11(String make_up_the_word_count_column_999999999_11) {this.make_up_the_word_count_column_999999999_11 = make_up_the_word_count_column_999999999_11;} public String getMake_up_the_word_count_column_999999999_12() {return make_up_the_word_count_column_999999999_12;} public void setMake_up_the_word_count_column_999999999_12(String make_up_the_word_count_column_999999999_12) {this.make_up_the_word_count_column_999999999_12 = make_up_the_word_count_column_999999999_12;} public String getMake_up_the_word_count_column_999999999_13() {return make_up_the_word_count_column_999999999_13;} public void setMake_up_the_word_count_column_999999999_13(String make_up_the_word_count_column_999999999_13) {this.make_up_the_word_count_column_999999999_13 = make_up_the_word_count_column_999999999_13;} public String getMake_up_the_word_count_column_999999999_14() {return make_up_the_word_count_column_999999999_14;} public void setMake_up_the_word_count_column_999999999_14(String make_up_the_word_count_column_999999999_14) {this.make_up_the_word_count_column_999999999_14 = make_up_the_word_count_column_999999999_14;} public String getMake_up_the_word_count_column_999999999_15() {return make_up_the_word_count_column_999999999_15;} public void setMake_up_the_word_count_column_999999999_15(String make_up_the_word_count_column_999999999_15) {this.make_up_the_word_count_column_999999999_15 = make_up_the_word_count_column_999999999_15;} public String getMake_up_the_word_count_column_999999999_16() {return make_up_the_word_count_column_999999999_16;} public void setMake_up_the_word_count_column_999999999_16(String make_up_the_word_count_column_999999999_16) {this.make_up_the_word_count_column_999999999_16 = make_up_the_word_count_column_999999999_16;} public String getMake_up_the_word_count_column_999999999_17() {return make_up_the_word_count_column_999999999_17;} public void setMake_up_the_word_count_column_999999999_17(String make_up_the_word_count_column_999999999_17) {this.make_up_the_word_count_column_999999999_17 = make_up_the_word_count_column_999999999_17;} public String getMake_up_the_word_count_column_999999999_18() {return make_up_the_word_count_column_999999999_18;} public void setMake_up_the_word_count_column_999999999_18(String make_up_the_word_count_column_999999999_18) {this.make_up_the_word_count_column_999999999_18 = make_up_the_word_count_column_999999999_18;} public String getMake_up_the_word_count_column_999999999_19() {return make_up_the_word_count_column_999999999_19;} public void setMake_up_the_word_count_column_999999999_19(String make_up_the_word_count_column_999999999_19) {this.make_up_the_word_count_column_999999999_19 = make_up_the_word_count_column_999999999_19;} public String getMake_up_the_word_count_column_999999999_20() {return make_up_the_word_count_column_999999999_20;} public void setMake_up_the_word_count_column_999999999_20(String make_up_the_word_count_column_999999999_20) {this.make_up_the_word_count_column_999999999_20 = make_up_the_word_count_column_999999999_20;}}