Open eduardkieser opened 6 years ago
Also Tried Forking the project.
After resolving gradle I try to build and run main.dart, but then I get:
Task 'assemble' not found in root project 'flutter_mlkit-master'.
Thanks reporting! I'll check it later.
Hi, eduardkieser
This issue may help you. https://github.com/azihsoyn/flutter_mlkit/issues/6#issuecomment-393729454 https://github.com/azihsoyn/flutter_mlkit/issues/6#issuecomment-393880362
Default FirebaseApp is not initialized
This error message will cause by invalid gradle configuration.
Please ensure setting follow by this guide. https://firebase.google.com/docs/android/setup?authuser=1
I am getting the same error FirebaseVisionTextRecognizer detector = FirebaseVision.getInstance() .getOnDeviceTextRecognizer(); gives me Make sure to call FirebaseApp.initializeApp(Context) first.
Hi, @CognitiveClouds-Prasad
Recently, Google's maven repository has changed. https://firebase.google.com/docs/android/setup
Please try below gradle.
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
Thanks.
Thank you for such a quick response! :) I am struggling so much. But, no luck! :(
I am not using any cloud functionality. So, I removed google services. Then, I have added google() in gradle. I have shared my gradle files.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "x.x.x.x"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-ml-vision:18.0.2'
}
Hi, @CognitiveClouds-Prasad
I am not using any cloud functionality. So, I removed google services.
This cause this.
If you don't use cloud detect function, MLKit requires firebase project.
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
This plugin parses google-services.json
and initialize your Firebase app ( FirebaseApp.initializeApp(Context)
)
Try adding gradle setting.
Thanks.
@azihsoyn Your suggestions are awesome! It worked for me!. So, thank you. :slightly_smiling_face:
I added classpath 'com.google.gms:google-services:4.1.0'. I also added apply plugin: 'com.google.gms.google-services'. I created a new Firebase app (from console.firebase.google.com) and then added that google-services.json as mentioned there (in 'app' folder). I am getting java.lang.IllegalStateException: Task is not yet complete. But, I think that is not related to this. I will figure the rest out.
and also after i add apply plugin: 'com.google.gms.google-services' Error" File google-services.json is missing. The Google Services Plugin cannot function without it."
Hi, @AmrHussienM !
Firebase app for android needs google-services.json.
Please try this 3rd step. https://firebase.google.com/docs/android/setup
@azihsoyn thank you for your suggestions; iam already did the 3rd step and the error same
🤔
Where is your google-services.json placed?
<flutter_root>
android/app/google_services.json
sample: https://github.com/azihsoyn/flutter_mlkit_sample/tree/master/android/app
Hi there, thank you for this plugin. I'm having a hard time getting the example to work: Steps: -Create new flutter project -add mlkit: "^0.4.1" and image_picker: "^0.4.5" to dependencies -get Packages -copy pase code from main.dart in example folder to my project main.dart
run: The app opens up, when I select a file it shows the image in the container, but no text overlay and the text widget simply says 'Empty' even though the text is large and clear.
I get the following output (including error) from the Run console every time I select an image: