Мне необходимо поддерживать минимальный уровень API Android на уровне 33, как того требует Play Store.
Я столкнулся с проблемой при попытке скомпилировать APK во Flutter. Ошибка возникает во время задачи :tflite:verifyReleaseResources , указывая, что ресурс android:attr/lStar не найден. Ниже приведено полное сообщение об ошибке:
Код: Выделить всё
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':tflite:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
> Android resource linking failed
ERROR:/Users/nico/Development/novo aqua/aquahelp/build/tflite/intermediates/merged_res/release/values/values.xml:194: AAPT: error: resource android:attr/lStar not found.
* 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.
BUILD FAILED in 22s
Running Gradle task 'assembleRelease'... 22.8s
Gradle task assembleRelease failed with exit code 1
Код: Выделить всё
Note: /Users/nico/.pub-cache/hosted/pub.dev/tflite-1.1.2/android/src/main/java/sq/flutter/tflite/TflitePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nico/.pub-cache/hosted/pub.dev/tflite-1.1.2/android/src/main/java/sq/flutter/tflite/TflitePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Это build.gradle в папке android/app:
Код: Выделить всё
buildscript {
ext.kotlin_version = '1.8.22'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
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"
}
android {
namespace = "com.example.aquahelp"
compileSdk = 33
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
allWarningsAsErrors false
lintOptions {
disable 'Deprecation'
disable 'Unsafe'
}
}
defaultConfig {
applicationId = "com.example.aquahelp"
minSdk = 26
targetSdk = 33
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
}
buildTypes {
release {
signingConfig = signingConfigs.debug
}
}
}
dependencies {
implementation "androidx.appcompat:appcompat:1.4.0" // Atualize para androidx
implementation "androidx.core:core-ktx:1.7.0" // Atualize para androidx
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.22" // Certifique-se de que a versão do Kotlin seja compatível
}
flutter {
source = "../.."
}
tasks.withType(JavaCompile) {
options.compilerArgs
Подробнее здесь: [url]https://stackoverflow.com/questions/78928993/error-compiling-flutter-apk-resource-androidattr-lstar-not-found[/url]