Reputation: 1623
I am getting the following error when trying to integrate Fabric into my Android app's Gradle file.
Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins.
My Gradle files look like the following:
apply plugin: 'com.android.application'
// Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.snapwebdevelopment.scanhappy"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// Displaying images
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.firebaseui:firebase-ui-auth:1.0.1'
compile 'com.firebaseui:firebase-ui-storage:0.6.0'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'me.dm7.barcodescanner:zxing:1.9'
compile 'com.google.android.gms:play-services-vision:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'me.anwarshahriar:calligrapher:1.0'
testCompile 'junit:junit:4.12'
compile 'com.stripe:stripe-android:2.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.braintreepayments:card-form:3.0.3'
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
transitive = true;
}
compile files('libs/org-apache-commons-codec.jar')
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'announce'
apply plugin: 'java'
And my top-level gradle file:
buildscript {
repositories {
jcenter()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I also added my API key in the manifest at the bottom right before my </application>
tag. Do I need to reorder something in my Gradle files?
Upvotes: 0
Views: 2755
Reputation: 788
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
//and the last apply plugin: 'com.google.gms.google-services'
Upvotes: 0
Reputation: 364556
You cannot apply both the com.android.application
and the java
plugin in the same module.
Remove the line with apply plugin: 'java'
Upvotes: 5