Android Studio 2022.2.1项目迁移报错1、No variants found for ':app'. Check build files to ensure at least one variant exists. at:,2、manifest merger failed with multiple errors see logs,3、module java.base does not “opens java.io“ to unnamed module。
PS:(2022.2.1)新版AS。。。
1,JDK17
2,AGP8.0,我仅更为7.1+
1,No variants found for ':app'. Check build files to ensure at least one variant exists. at:
网上解决方案
Android SDK Build-tools版本不匹配,去AS的Settings下载自己需要的SDK相关配置,但对我不生效。
https://stackoverflow.com/questions/64682582/no-variants-found-for-app-check-build-files-to-ensure-at-least-one-variant-ex
分享我的解决方法:
repositories {
flatDir {
dirs 'libs'
}
// maven {
// url "http://dl.bintray.com/jlmd/maven"
// }
}
2、manifest merger failed with multiple errors see logs
去Terminal输入以下命令查看具体Log
./gradlew processReleaseManifest --stacktrace
解决:除了清单文件添加属性之外,请检查项目以及Model和三方依赖SdkVersion版本尽量保持一致
3、module java.base does not “opens java.io“ to unnamed module
1,添加以下代码
maven { url 'https://jitpack.io' }
2,升级自己的AGP版本。。即可解决
#Thu Dec 22 18:17:29 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
classpath 'com.android.tools.build:gradle:7.1.2'
3,有些github拉取的项目依旧无法运行,尝试更改JDK来解决文章来源:https://www.toymoban.com/news/detail-471196.html
4,有些项目可尝试升级 ext.kotlin_version版本号 文章来源地址https://www.toymoban.com/news/detail-471196.html
ext.kotlin_version = "1.6.10" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
到了这里,关于No variants found for ‘:app‘. Check build files to ensure at least one variant exists. at: 2022.2.1的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!