Failed to find Platform SDK with path: platforms;android-P

亡梦爱人 提交于 2019-12-22 06:46:18

问题


Error:FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':app'.

Failed to find Platform SDK with path: platforms;android-P

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 'android-P'
        defaultConfig {
            applicationId "com.google.codelabs.mdc.java.shrine"
            minSdkVersion 15
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            vectorDrawables.useSupportLibrary = true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
     }

    dependencies {
        api 'com.android.support:design:28.0.0-alpha1'
        implementation 'com.android.support:support-v4:28.0.0-alpha1'
        implementation 'com.android.volley:volley:1.1.0'
        implementation 'com.google.code.gson:gson:2.8.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    }

回答1:


Step 1: Open Preferences or Settings in Android studio. Select Android SDK options and Install Android API 28 as selected below.

Step 2: There's a problem with compileSdkVersion as you have to change it from 'android-P' to 28.

compileSdkVersion 28

And Build project. That's it.




回答2:


To fully test your app's compatibility with Android P and begin using new APIs, open your module-level build.gradle file and update the compileSdkVersion and targetSdkVersion as shown here:

android {
    compileSdkVersion 28

    defaultConfig {
        targetSdkVersion 28
    }
    ...
}

Set Up the Android P SDK



来源:https://stackoverflow.com/questions/51183581/failed-to-find-platform-sdk-with-path-platformsandroid-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!