简体   繁体   中英

why i am not able to run my flutter project in android constantly getting gradle error?

图像以提供有关我的问题的更多信息 [:[* What went wrong: Could not determine the dependencies of task ':app.mergeDebugAssets': > Could not resolve all dependencies for configuration ':app.debugRuntimeClasspath': > Could not create task ':app.minifyReleaseWithR8': > Failed to find Platform SDK with path; platforms;android-31

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s
Exception: Gradle task assembleDebug failed with exit code 1][1]][1]

i'm getting error constantly regarding gradle task have wasted 3 days by searching for it but didn't got any solution yet information might be needed

android/build.gradle

dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'//by default it was 4.1.2 but was getting error Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 so I changed to 7.0.2 considering someone's suggestion
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }

gradle-wraper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip //before it was gradle-6.7

Failed to find Platform SDK with path: platforms;android-31 that means there is no android SDK folder

  1. to get the latest Android API on you computer, run android list target, if you don't find Android API 31 in the list, you might install it through Android studio

$ android list target

enter image description here

  1. after installing Android API 31,
  • find Android SDK Location in the project preferences
  • check whether sdk.dir is correct in "local.properties" file in android folder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM