如何将tensor flow lite插件转换为flutter的非命令式语法

问题描述 投票:0回答:1

由于命令式声明已被弃用,我尝试转换我的插件但没有成功(不支持分号):

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0" // OK
    id "com.android.application" version "7.3.0" apply false // OK
    id "org.jetbrains.kotlin.android" version "1.7.10" apply false //OK
    id "org.tensorflow:tensorflow-lite" version "0.1.100" apply false // KO
    id "org.tensorflow:tensorflow-lite-select-tf-ops" version "0.1.100" apply false // KO

}

我也尝试过,但没有成功:

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0" // OK
    id "com.android.application" version "7.3.0" apply false // OK
    id "org.jetbrains.kotlin.android" version "1.7.10" apply false // OK
    id "org.tensorflow.tensorflow.lite" version "0.1.100" apply false // KO
    id "org.tensorflow.tensorflow.lite.select.tf.ops" version "0.1.100" apply false // KO

}
flutter gradle android-gradle-plugin tensorflow-lite
1个回答
0
投票

弃用命令式插件声明仅影响插件。这些

tensorflow
工件属于
dependencies
中的
build.gradle
块,因为它们是应用程序的运行时依赖项,而不是构建的构建时依赖项。

所以,你

plugins
块应该保持这样:

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
    id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

tensorflow
块中的
dependencies
依赖项:

dependencies {
    // using latest version from maven-central
    implementation 'org.tensorflow:tensorflow-lite:2.16.1'
    implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:2.16.1'

}
© www.soinside.com 2019 - 2024. All rights reserved.