简体   繁体   English

Flutter Android:一个或多个插件需要更高的Android NDK版本

[英]Flutter Android: One or more plugins require a higher Android NDK version

One or more plugins require a higher Android NDK version.一个或多个插件需要更高的 Android NDK 版本。

Fix this issue by adding the following to /Users/qqq/data/github/qqq/qqq/android/app/build.gradle: android { ndkVersion 21.3.6528147... }通过将以下内容添加到 /Users/qqq/data/github/qqq/qqq/android/app/build.gradle 来解决此问题:android { ndkVersion 21.3.6528147... }

But if I add ndkVersion and my file looks like this:但是如果我添加ndkVersion并且我的文件如下所示:


android {
    compileSdk 31

    ndkVersion 21.3.6528147

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
...

I receive different error:我收到不同的错误:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/qqq/data/qqq/qqq/qqq/android/app/build.gradle' line: 61

* What went wrong:
Could not compile build file '/Users/qqq/data/github/qqq/qqq/android/app/build.gradle'.
> startup failed:
  build file '/Users/qqq/data/github/qqq/qqq/android/app/build.gradle': 61: Unexpected input: '{' @ line 61, column 9.
     android {
             ^

  1 error

According to official doc( https://developer.android.com/ndk/downloads ) latest ndk version is 25.0.8775105 just update to latest and error should be gone.根据官方文档( https://developer.android.com/ndk/downloads )最新的 ndk 版本是25.0.8775105刚刚更新到最新并且错误应该消失了。

android {
    ndkVersion "25.0.8775105" <-- add this line
}

I was facing the same issue and I managed to solve it, by setting default values...MyProject\android\app\build.gradle我遇到了同样的问题,我设法通过设置默认值来解决它...MyProject\android\app\build.gradle

defaultConfig {
   
    targetSdkVersion 33
    minSdkVersion 30
   ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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