I followed google documentation to integrate my app to Google Analytics. But when adding
apply plugin: 'com.google.gms.google-services'
and building my app, I encountered this error:
Error:(49, 0) For input string: "+"
These are the settings I used in the build.gradle of my application:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.myapp.xyz"
manifestPlaceholders = [
manifestApplicationId : "${applicationId}",
onesignal_app_id : "ccd48c54-2069-41f9-8ff7-54c7a12f2d18a",
onesignal_google_project_number: "306632981237"
]
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// compile 'com.android.support:appcompat-v7:22.2.1'
compile project(':facebook')
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:palette-v7:22.2.1'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.onesignal:OneSignal:1.+@aar'
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
}
apply plugin: 'com.google.gms.google-services'
These are the setting in build.gradle application:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
The google-services plugin has two main functions: Process the google-services. json file and produce Android resources that can be used in your application's code. See Adding the JSON File more information. Add dependencies for basic libraries required for the services you have enabled.
Get config file for your Android appIn the Your apps card, select the package name of the app for which you need a config file. Click google-services. json. Move your config file into the module (app-level) directory of your app.
At first you should call
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha2'
}
Don't (Avoid calling +
)
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services:8.4.0'
Do
compile 'com.google.android.gms:play-services:8.4.0'
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