I want to use some native library. and I am using below dependnecy
implementation 'com.google.android.gms:play-services-vision:10.+'
in build.gradle in flutter project.
How I will sync that dependency. Please help me!
If you're using Android Studio for Flutter development, right click on the android folder in your Flutter project. Select "Flutter" -> "Open Android Module in Android Studio".
Or
Simply start Android Studio and open the Android (sub)project directly.
In any case, once the Android project is opened in Android Studio, you can make changes in your build.gradle. The editor will tell you to sync. Otherwise simply execute a build. Afterwards you will be able to import use your Android classes.
That is the problem with gradle sync of Android project, not with Flutter dependencies.
In your build.gradle of your module (for example android/app/build.gradle of your Flutter project) add:
implementation 'com.google.android.gms:play-services-vision:10.+'
in dependencies as bellow:
dependencies {
implementation 'com.google.android.gms:play-services-vision:10.+'
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'
}
Then open terminal, cd to android
folder of your flutter project and run:
$./gradlew build
After that you will be able import com.google.android.gms...
in your Java class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With