I am a beginner in Ionic+Angular. I am having an issue with Gradle Sync. Android Studio says ‘Android Gradle plugin 4.0.1 must not be applied to project ‘/Users/zerobstacle/Desktop/capacitor-test/water-meter-reading/android/capacitor-cordova-android-plugins’ since version 4.0.1 was already applied to this project’. I think this problem started when I tried using the Firebase Vision plugin from Cordova.
Here is my build.gradle
:
ext {
cordovaAndroidVersion = project.hasProperty('cordovaAndroidVersion') ? rootProject.ext.cordovaAndroidVersion : '7.0.0'
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 29
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
targetSdkVersion targetSdkVersion = project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
google()
jcenter()
mavenCentral()
flatDir{
dirs 'src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(dir: 'src/main/libs', include: ['*.jar'])
implementation "org.apache.cordova:framework:$cordovaAndroidVersion"
// SUB-PROJECT DEPENDENCIES START
implementation "com.google.firebase:firebase-ml-vision:24.+"
implementation "com.google.firebase:firebase-ml-vision-barcode-model:16.+"
// SUB-PROJECT DEPENDENCIES END
}
// PLUGIN GRADLE EXTENSIONS START
apply from: "cordova.variables.gradle"
apply from: "../../node_modules/cordova-plugin-firebase-mlvision/src/android/build.gradle"
// PLUGIN GRADLE EXTENSIONS END
for (def func : cdvPluginPostBuildExtras) {
func()
}
Your help will be so much appreciated. Thank you!