С Flutter ошибка при построении gradle SdkVersionAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 С Flutter ошибка при построении gradle SdkVersion

Сообщение Anonymous »

Я создаю флаттер-приложение для Android. Я нахожусь на этапе развертывания и, пытаясь решить какую-то проблему, сталкиваюсь с множеством проблем совместимости. Вот самое сложное, что мне нужно для создания градиента с помощью ./gradlew clean build. Чистый проход, но не сборка, и после нескольких часов безуспешных попыток вы - моя последняя надежда.
Вот полная ошибка:

Код: Выделить всё

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

1.  Dependency 'androidx.window:window-java:1.0.0-beta04' requires libraries and applications that
depend on it to compile against version 31 or later of the
Android APIs.

:device_info is currently compiled against android-29.

Recommended action: Update this project to use a newer compileSdkVersion
of at least 31, 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.window:window:1.0.0-beta04' requires libraries and applications that
depend on it to compile against version 31 or later of the
Android APIs.

:device_info is currently compiled against android-29.

Recommended action: Update this project to use a newer compileSdkVersion
of at least 31, 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).
Вот текущий app/build.gradle (я уже пробовал версии 31 и 33 и даже установил зависимость, как вы можете видеть

Код: Выделить всё

plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}

configurations.all {
resolutionStrategy { force 'androidx.window:window-java:1.0.0-beta04' }}

android {
namespace = "com.example.s3nsa_app"
compileSdk = 31

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.s3nsa_app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 21
targetSdk = 31
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.debug
}
}
}

flutter {
source = "../.."
}

Спасибо за помощь!

Подробнее здесь: https://stackoverflow.com/questions/787 ... sdkversion
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»