regulaforensics / flutter_face_api

MIT License
31 stars 14 forks source link

[BR] (use -source 8 or higher to enable default methods) #16

Open Gizmo1337 opened 1 year ago

Gizmo1337 commented 1 year ago

Before Submitting, be sure to

Bug Description

Cannot build on existing project getting -source 7 error. Only for Flutter Android, Works on iOS

Tried multiple JDK's from 8 , 11, 19;

Current buildGradle : android { compileSdkVersion 33 // ndkVersion "25.1.8937393" // compileOptions { // sourceCompatibility JavaVersion.VERSION_1_8 // targetCompatibility JavaVersion.VERSION_1_8 // }

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

defaultConfig {

    applicationId "my.id"
    minSdkVersion 21
    targetSdkVersion 33
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

As soon as I commnet face_api from pubspec it all works.

Steps To Reproduce

Expected behavior

For the app to build, tried the same Android config from Demo, used JDK 8, 11, 19

Environment:

Additional context Error Logs: /Users/u/.pub-cache/hosted/pub.dev/flutter_face_api-5.1.1/android/src/main/java/io/flutter/plugins/regula/faceapi/flutter_face_api/FlutterFaceApiPlugin.java:74: error: default methods are not supported in -source 7 default void success() { ^ (use -source 8 or higher to enable default methods) /Users/u/.pub-cache/hosted/pub.dev/flutter_face_api-5.1.1/android/src/main/java/io/flutter/plugins/regula/faceapi/flutter_face_api/FlutterFaceApiPlugin.java:120: error: lambda expressions are not supported in -source 7 new Handler(Looper.getMainLooper()).post(() -> eventVideoEncoderCompletion.success(JSONConstructor.generateVideoEncoderCompletion(transactionId, success).toString())); ^ (use -source 8 or higher to enable lambda expressions) /Users/u/.pub-cache/hosted/pub.dev/flutter_face_api-5.1.1/android/src/main/java/io/flutter/plugins/regula/faceapi/flutter_face_api/FlutterFaceApiPlugin.java:291: error: method references are not supported in -source 7 Instance().setVideoEncoderCompletion(this::sendVideoEncoderCompletion); ^ (use -source 8 or higher to enable method references) /Users/u/.pub-cache/hosted/pub.dev/flutter_face_api-5.1.1/android/src/main/java/io/flutter/plugins/regula/faceapi/flutter_face_api/JSONConstructor.java:647: error: method references are not supported in -source 7 result.put("detections", generateList(input.getDetections(), JSONConstructor::generateMatchFacesDetection)); ^ (use -source 8 or higher to enable method references) 4 errors

FAILURE: Build failed with an exception.

BUILD FAILED in 4s Exception: Gradle task assembleDebug failed with exit code 1

sikaiichi commented 1 year ago

Update this file gradle-wrapper.properties

Fri Jun 23 08:50:38 CEST 2017

distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip . it worked to me

hafeezrana commented 1 year ago

just changed gradle version to 7.1.2 like

dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
    }

and gradle-wrapper.properties to 7.4 like distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

fixed my problem