Среда:
Flutter SDK: последняя версия (я уже запускал обновление флаттера).
Плагин Gradle: com.android.tools.build:gradle:8.1.0.
Скомпилировать SDK: 34.
Файлы конфигурации: я включил ключевые файлы конфигурации:
app/build.gradle
android/build. gradle
pubspec.yaml
tflite-1.1.2/android/build.gradle. Полная информация о конфигурации представлена ниже (код прилагается).
Уже предпринятые шаги:
CompileSdkVersion обновлен до версии 34 для всех соответствующие файлы.
Подключаемый модуль Gradle обновлен до версии 8.1.0.
Запустил flutter clean и flutter pub get.
Код: Выделить всё
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: /Users/baka/.pub-cache/git/flutter_tflite-41d3edb62ca676b9b991c4d5c65bd2b602b1c279/android/src/main/java/sq/flutter/tflite/TflitePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/baka/.pub-cache/git/flutter_tflite-41d3edb62ca676b9b991c4d5c65bd2b602b1c279/android/src/main/java/sq/flutter/tflite/TflitePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 warnings
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/baka/Documents/Application/MyApplication/application/build/tflite/intermediates/merged_res/release/mergeReleaseResources/values/values.xml:194: AAPT: error: resource android:attr/lStar not found.
Код: Выделить всё
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
android {
namespace "com.example.application"
compileSdk = 34
ndkVersion = "27.0.12077973"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
defaultConfig {
applicationId = "com.example.myapp"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = 21
targetSdk = 33
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
signingConfig = signingConfigs.debug
}
}
}
flutter {
source = "../.."
}
Код: Выделить всё
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Код: Выделить всё
cupertino_icons: ^1.0.8
flutter_svg: ^2.0.10+1
image_picker: ^1.1.2
camera: ^0.10.6
tflite:
git:
url: https://github.com/tech-ramakant/flutter_tflite.git
ref: Namespace_not_specified_fix
Код: Выделить всё
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.7.2' apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}
include ":app"
Код: Выделить всё
group 'sq.flutter.tflite'
version '1.0-SNAPSHOT'
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.0'
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
android {
namespace "sq.flutter.tflite"
compileSdkVersion 28
defaultConfig {
minSdkVersion 19
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
lintOptions {
disable 'InvalidPackage'
}
dependencies {
implementation 'org.tensorflow:tensorflow-lite:+'
implementation 'org.tensorflow:tensorflow-lite-gpu:+'
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... eresources