shaqian / flutter_tflite

Flutter plugin for TensorFlow Lite
https://pub.dartlang.org/packages/tflite
MIT License
631 stars 404 forks source link

A problem occurred evaluating project ':tflite'. #231

Open arunkumard001 opened 2 years ago

arunkumard001 commented 2 years ago

wheni run my flutter run i get this error

FAILURE: Build failed with an exception.

rocaes commented 2 years ago

Did you find any solution? I'm facing the same problem, tried to downgrade gradle version and it works but doesn't let me work with other features (so it's not a solution). Did anyone solved it?

arunkumard001 commented 2 years ago

s i found a solve i using a git rep just paste in your pubspec.yaml file at dependencis tflite: git: url: https://github.com/zhengbomo/flutter_tflite.git ref: master

rocaes commented 2 years ago

Still having using gradle 4.2.0, doesn't allows you to work with 7.0.2 but thanks anyway, I'll let you know if I find a different solution

himsa commented 2 years ago

@rocaes did you find other solution ?

rocaes commented 2 years ago

@himsa I made a workaround that is not exactly a solution but it solved my problem at least for the project i had at that time, so that I made a web page with tensorflow.js and i used a webview, which is not the best solution but, it worked out for me. I don't know if you can use it as a solution...

NavidHosseini commented 2 years ago

Hello, you can use my repo

tflite_maven: git: url: https://github.com/NavidHosseini/tflite.git ref: master

Its is work fine for now

Yosi2020 commented 2 years ago

Change the android/build.dradle

    buildscript {
        ext.kotlin_version = '1.6.21'
        repositories {
            google()
            jcenter()
        }

        dependencies {
            classpath 'com.android.tools.build:gradle:4.1.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
        }
    }

    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
        project.evaluationDependsOn(':app')
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

And change the app/build.gradle

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

        def flutterRoot = localProperties.getProperty('flutter.sdk')
        if (flutterRoot == null) {
            throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
        }

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

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

        apply plugin: 'com.android.application'
        apply plugin: 'kotlin-android'
        apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

        android {
            compileSdkVersion 32

            sourceSets {
                main.java.srcDirs += 'src/main/kotlin'
            }

            defaultConfig {
                // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
                applicationId "your app name"
                // You can update the following values to match your application needs.
                // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
                minSdkVersion 21
                targetSdkVersion 32
                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
                }
            }
            aaptOptions {
                noCompress 'tflite'
                noCompress 'lite'
            }
        }

        flutter {
            source '../..'
        }

        dependencies {
            implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        }