android - 无法找到具有路径的平台 SDK:平台;android-R
问题描述
错误:FAILURE:构建失败并出现异常。
出了什么问题:配置项目“:app”时出现问题。无法找到具有路径的平台 SDK:平台;android-P
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
maven {
url 'http://storage.googleapis.com/r8-releases/raw'
}
}
dependencies {
classpath 'com.android.tools:r8:1.5.25'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
解决方案
please put this code at the end of android/build.gradle Hopefully, it solves your issue.
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
afterEvaluate {project ->
if (project.hasProperty("android") && project.property("android").compileSdkVersion.equals("android-R")) {
android {
compileSdkVersion 30
}
}
}
}
推荐阅读
- python - Django 的 html 电子邮件的内联 css 不起作用
- influxdb - 从 infosql 输出中删除测量名称
- python - 如果它包含任何字母(非数字),如何从熊猫数据框中删除多列?
- javascript - 如何在依赖于另一个方法值的构造函数中初始化处于状态的方法
- apache-spark - Spark逻辑回归套索运行非常慢
- c# - 如何重构方法以用 IOrganizationService 替换 OrganizationServiceProxy
- python - 向下转换为 pybind11 派生类
- android - EventBus - 线程模式未重新定义为@Subscribe 注释属性:无法解析方法线程模式
- nuget - Chocolatey - 无法从 Artifactory 找到包裹
- jsf - How to escape double quotes for Primefaces SelectOneMenu in Application level?