I am not good at English, so I used a translator and a dictionary. Please understand if there is an awkward sentence, and if you don't understand what I'm saying, please let me know.
I git cloned the code from https://github.com/AGRapista/FitnessInstructor to run TensorFlow's MoveNet singlepose lighting model on the flutter and ran it on my computer.
When the code was first executed, some errors occurred, and the following methods were resolved, and the code was corrected.
- : Error: 'Size' is imported from both 'dart:ffi' and 'dart:ui'.
I solved this problem in the following way.
lib/test.dart
from
import 'dart:ffi';
import 'dart:ui';
to
import 'dart:ui';
- Member not found: 'UnicodeChar'
I solved it after watching the next YouTube video.
https://www.youtube.com/watch?v=lxeB5ZZyJXM
3.
...
e: C:/Users/USER/.gradle/caches/transforms-2/files-2.1/06445d7ee3d674db365da5b7e383aeec/jetified-window-1.0.0-beta04-api.jar!/META-INF/window_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
...
I thought I should fix it to version 1.1.15, but strangely, when I fixed it to version 1.5.0, this error disappeared.
android\build.gradle
from
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
to
buildscript {
ext.kotlin_version = '1.5.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
android\app\build.gradle
from
...
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
...
to
...
if (flutterRoot == null) {
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
...
Problems solved but I don't know why or how.
1.
...
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\camera_android-0.9.8+3\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:154: warning: [deprecation] get(int,int) in CamcorderProfile has been deprecated
...
I tried to solve the problem by inserting the following code into the pubspec.yaml file, but only the following error occurred.
pubspec.yaml
from
dependencies:
flutter:
sdk: flutter
camera: ^0.9.4+5
image: ^3.1.0
tflite_flutter: ^0.9.0
tflite_flutter_helper: ^0.3.1
path_provider: ^2.0.8
to
dependencies:
flutter:
sdk: flutter
camera: ^0.9.4+5
git:
url: https://github.com/flutter/plugins
path: packages/camera/camera
ref: 9e46048ad2e1f085c1e8f6c77391fa52025e681f
path_provider:
path:
The error
Error on line 33, column 8: Mapping values are not allowed here. Did you miss a colon earlier?
╷
33 │ url: https://github.com/flutter/plugins
│ ^
╵
What's even more strange is that when I deleted
git:
url: https://github.com/flutter/plugins
path: packages/camera/camera
ref: 9e46048ad2e1f085c1e8f6c77391fa52025e681f
and ran it, that error disappeared.
2.
I tried to solve the problem by inserting the following code into the pubspec.yaml file, but only the following error occurred.
Running "flutter pub get" in FitnessInstructor...
Launching lib\main.dart on SM A826S in debug mode...
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\tflite_flutter_helper-0.3.1\android\src\main\kotlin\com\tfliteflutter\tflite_flutter_helper\TfliteFlutterHelperPlugin.kt: (43, 1): Class 'TfliteFlutterHelperPlugin' is not abstract and does not implement abstract member public abstract fun onRequestPermissionsResult(p0: Int, p1: Array<(out) String!>, p2: IntArray): Boolean defined in io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\tflite_flutter_helper-0.3.1\android\src\main\kotlin\com\tfliteflutter\tflite_flutter_helper\TfliteFlutterHelperPlugin.kt: (143, 2): 'onRequestPermissionsResult' overrides nothing
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':tflite_flutter_helper:compileDebugKotlin'.
> Compilation error. See log for more details
* 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 5s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I Googled with 'Execution failed for task ':tflite_flutter_helper:compileDebugKotlin'' but I couldn't find a suitable solution.
I tried to solve the problem by inserting the following code into the pubspec.yaml file, but only the following error occurred.
pubspec.yaml
from
dependencies:
flutter:
sdk: flutter
camera: ^0.9.4+5
image: ^3.1.0
tflite_flutter: ^0.9.0
tflite_flutter_helper: ^0.3.1
path_provider: ^2.0.8
to
dependencies:
flutter:
sdk: flutter
camera: ^0.9.4+5
image: ^3.1.0
tflite_flutter: ^0.9.0
tflite_flutter_helper: ^0.3.1
git:
url: https://github.com/elephantum/tflite_flutter_helper.git
ref: a7d7a59a33f7cffa0a2a12ab05625807622cc97a
path_provider: ^2.0.8
The error
Error detected in pubspec.yaml:
Error on line 36, column 8: Mapping values are not allowed here. Did you miss a colon earlier?
╷
36 │ git:
│ ^
╵
What's even more strange is that when I deleted
git:
url: https://github.com/elephantum/tflite_flutter_helper.git
ref: a7d7a59a33f7cffa0a2a12ab05625807622cc97a
and ran it, that error disappeared.
CURRENT PROBLEM
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.1/kotlin-gradle-plugin-1.5.1.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.1/kotlin-gradle-plugin-1.5.1.pom
Required by:
project :
* 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 2s