1.修改gradle文件,增加如下内容:
bash
DEFAULT_JVM_OPTS="-Xmx5120m --add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED"
- 修改gradle.properties文件
增加下面内容:
bash
org.gradle.daemon=true
org.gradle.parallel=true
3.修改build.gradle 所有仓库地址加上HTTPS验证:allowInsecureProtocol true
bash
repositories {
maven {
allowInsecureProtocol true
url "https://repo1.maven.org/maven2"
}
maven {
allowInsecureProtocol true
url 'https://maven.aliyun.com/repository/google'
}
maven {
allowInsecureProtocol true
url 'https://maven.aliyun.com/repository/jcenter'
}
maven {
allowInsecureProtocol true
url 'http://maven.aliyun.com/nexus/content/groups/public'
}
}
- gradle build-tools 改为如下:
bash
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
- gradle版本改为7.2位于gradle-wrapper.properties文件中
bash
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
android.enableAapt2=false
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
7.修改后编译成功如下:
8.在QtCreator中编译成功
生成APK安装包成功
安装到设备