MCarlomagno / FaceRecognitionAuth

😀🤳 Simple face recognition authentication (Sign up + Sign in) written in Flutter using Tensorflow Lite and Firebase ML vision library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The code is not working in flutter 2.10

SiddharthOza00 opened this issue · comments

Does anyone have any idea on how to migrate this code to flutter 2.10 because this code is in flutter 2.7 and there have many syntax changes since then. So can anyone please help? @peterlazar1993 @MCarlomagno

I am also interested in this

try this :
https://stackoverflow.com/questions/65018588/your-flutter-application-is-created-using-an-older-version-of-the-android-embedd

if platform error try ovverides in pubspec.yaml:
dependency_overrides:
platform: ^3.1.0

and last is change graddle-wapper.properties version to this
gradle-6.6.1-all.zip

its work for me

Can you share your code please? @guruhyes

in manifest
`

<application
    android:name="${applicationName}"
    android:label="FaceNet"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
     <meta-data
        android:name="com.google.firebase.ml.vision.DEPENDENCIES"
        android:value="ocr" />
    <!-- To use multiple models: android:value="ocr,label,barcode,face" -->
</application>

`

in wrapper properties
image

in pubspec
image

I did that but its still not working if you have it then can you share the entire code? @guruhyes

what error message are you getting

Nevertheless try the following changes that worked for me

in android/build.gradle change the ext.Kotlin_version to the latest i.e 1.6.10 and the gradle version in the dependencies

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

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

in pubspec.yaml change camera entry to

 camera:
    git:
      url: https://github.com/flutter/plugins
      path: packages/camera/camera
      ref: 9e46048ad2e1f085c1e8f6c77391fa52025e681f

my android/app/build.gradle looks like

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 FileNotFoundException("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: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    aaptOptions {
        noCompress "tflite"
        noCompress "lite"
    }

    compileSdkVersion 31

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.FaceNet"
        minSdkVersion 21
        targetSdkVersion 29
        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
        }
    }

}

flutter {
    source '../..'
}

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

I did that but its still not working if you have it then can you share the entire code? @guruhyes

can you show the error log?
or

you can try @KALU-KELECHI-GABRIEL solution

@KALU-KELECHI-GABRIEL there is still error in app/build.gradle code you shared

In your project you are using flutter 2.7 not the latest one @KALU-KELECHI-GABRIEL .
Also I am getting these errors
error

Hi Guys, sorry for the late answer, I just updated the project to null safety. I'm going to work on the issues found later, thanks for contribuiting!