1

I'm trying to use tflite plugin to use model for emotion detection app. But there is an error showed. Any help would be greatly appreciated.

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\flutter\.pub-cache\hosted\pub.dartlang.org\tflite-1.1.2\android\build.gradle' line: 24

* What went wrong:
A problem occurred evaluating project ':tflite'.
> No signature of method: build_29ou9k6xal0pml6qvuo3exmb2.android() is applicable for argument types: (build_29ou9k6xal0pml6qvuo3exmb2$_run_closure2) values: [build_29ou9k6xal0pml6qvuo3exmb2$_run_closure2@4db06c22]

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1
  • I see the same problem. In the tflite gradle file there are dependencies for `compile 'org.tensorflow:tensorflow-lite:+'` which I believe is the root cause of the problem. I'm not sure how gradle is supposed to import and compile `org.tensorflow:tensorflow-lite:+`. – Dark Matter Jul 20 '22 at 17:33
  • I was able to successfully build after following steps in https://stackoverflow.com/questions/70309075/problems-in-android-repository-flutter-tensorflow-lite-by-bintray-502 – Dark Matter Aug 05 '22 at 17:11

2 Answers2

0

Finally, I got the solution the problem was in the Gradle file which has to be changed from compile to API. The new implementation of Gradle 7.0 and up replaced the compile configuration with API but the tflite plugin is not updated to match Gradle 7 configuration.

You will find the file in this location in windows

C:\Users\[your username]\AppData\Local\Pub\Cache\hosted\pub.dev\tflite-1.1.2\android\build.gradle 

Or you can use relative path

%AppData%\Local\Pub\Cache\hosted\pub.dev\tflite-1.1.2\android\build.gradle

OR extract the path from the error message.

For more information please visit Gradl website

Table 1. Common configuration upgrades

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Jeremy Caney Mar 07 '23 at 00:33
0

Thanks to Masood AL-BADAWI. He means to replace compile with implementation in the mentioned file

C:\flutter\.pub-cache\hosted\pub.dartlang.org\tflite-1.1.2\android\build.gradle' line: 24

The lines should be like:

dependencies {
        implementation 'org.tensorflow:tensorflow-lite:+'
        implementation 'org.tensorflow:tensorflow-lite-gpu:+'
    }