提问者:小点点

找不到Platform SDK,路径为:Platforms;Android-R


错误:失败:生成失败,出现异常。

错误内容:配置项目“:app”时出现问题。 找不到Platform SDK,路径为:Platforms;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
}

共1个答案

匿名用户

请把这段代码放在Android/build.gradle的末尾希望它能解决你的问题。

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
            }
        }
    }
}