Home » Java » error Gradle sync failed: For input string: “ 12” when apply plugin: 'com.google.gms.google-services'

error Gradle sync failed: For input string: “ 12” when apply plugin: 'com.google.gms.google-services'

Posted by: admin June 30, 2018 Leave a comment

Questions:

I followed google documentation to integrate my app to Google Analytics. But when adding on Module: app build.gradle

apply plugin: ‘com.google.gms.google-services’

and building my app, I encountered this error:

Gradle sync failed: For input string: ” 12″

My project build.gradle is:

plugins {
    id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.android.application'
apply plugin: 'io.objectbox'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId 'xxx.xxxx.xxxxx'
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 74
        versionName "1.0.5"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        manifestPlaceholders = [onesignal_app_id               : "xxxxx-xxxxxx-xxx",
                                onesignal_google_project_number: "REMOTE"]

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ['objectbox.debug': 'true']
            }
        }
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'

    implementation 'com.google.firebase:firebase-core:15.0.2'
    implementation 'com.google.firebase:firebase-messaging:15.0.2'

    implementation 'com.facebook.android:facebook-login:[4,5)'
    compile 'com.facebook.android:facebook-share:[4,5)'
    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:design:27.1.1'
    implementation 'com.orhanobut:logger:2.2.0'
    compile 'joda-time:joda-time:2.9.9'
    compile('com.afollestad:bridge:5.1.2') {
        exclude group: 'org.json', module: 'json'
    }
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
    compile 'jp.wasabeef:blurry:2.1.1'
    compile 'com.makeramen:roundedimageview:2.3.0'
    compile('com.redmadrobot:inputmask:2.3.0') {
        exclude group: 'org.jetbrains', module: 'annotations'
    }
    compile 'se.emilsjolander:stickylistheaders:2.7.0'
    compile 'com.daimajia.easing:library:[email protected]'
    compile 'com.daimajia.androidanimations:library:[email protected]'
    compile 'com.github.javadev:underscore:1.29'
    compile 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
    compile 'com.mixpanel.android:mixpanel-android:5.+'
    compile 'com.github.thomper:sweet-alert-dialog:v1.4.0'
    compile 'com.github.faranjit:currency-edittext:1.0.1'
    compile 'org.apache.commons:commons-lang3:3.7'
    compile 'com.google.guava:guava:24.1-android'
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
        transitive = true
    }
    compile('com.github.worker8:tourguide:[email protected]') {
        transitive = true
    }
}

apply plugin: 'com.google.gms.google-services'

and app build.gradle is:

buildscript {
    ext.objectboxVersion = '1.5.0'
    repositories {
        jcenter()
        google()
        mavenCentral()
        maven { url "http://objectbox.net/beta-repo/" }
        maven { url 'https://maven.google.com' }
        maven { url 'https://jitpack.io' }
        maven { url "https://raw.githubusercontent.com/smilefam/SendBird-SDK-Android/master/" }
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'com.google.gms:google-services:3.3.1'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        mavenCentral()
        maven { url "http://objectbox.net/beta-repo/" }
        maven { url 'https://maven.google.com' }
        maven { url 'https://jitpack.io' }
        maven { url "https://raw.githubusercontent.com/smilefam/SendBird-SDK-Android/master/" }
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
}

task clean(type: Delete) {

    delete rootProject.buildDir
}

if I remove apply

plugin: ‘com.google.gms.google-services’

, the build normally works. But Firebase does not start correctly.

Answers: