flutter 项目报错 One or more plugins require a higher Android SDK version.

One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to D:\xxx\android\app\build.gradle:
android {
  compileSdkVersion 33
  ...
}

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > 4 issues were found when checking AAR metadata:

       1.  Dependency 'androidx.appcompat:appcompat-resources:1.5.1' requires libraries and applications that
           depend on it to compile against version 32 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 32, for example 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       2.  Dependency 'androidx.appcompat:appcompat:1.5.1' requires libraries and applications that
           depend on it to compile against version 32 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 32, for example 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       3.  Dependency 'androidx.emoji2:emoji2-views-helper:1.2.0' requires libraries and applications that
           depend on it to compile against version 32 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 32, for example 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

       4.  Dependency 'androidx.emoji2:emoji2:1.2.0' requires libraries and applications that
           depend on it to compile against version 32 or later of the
           Android APIs.

           :app is currently compiled against android-31.

           Recommended action: Update this project to use a newer compileSdkVersion
           of at least 32, for example 33.

           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

  修改方案:找到本地flutter安装目录D:\flutter\flutter_windows_3.3.1-stable\flutter\packages\flutter_tools\gradle,修改flutter.gradle文件内static int compileSdkVersion = 31==》static int compileSdkVersion = 33

posted @ 2022-12-13 10:09  bg_不够  阅读(4889)  评论(0编辑  收藏  举报