Google Play Services GCM - android

I try to add google analitics to my app but I get error in build.gradle:
Error: Execution failed for task ':app:mergeProductionDebugResources'.
\app\build\generated\res\google-services\production\debug\xml\global_tracker.xml: Error: Duplicate resources
but the wrong in my code:
This is my app level gradle
android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('src/main/java/libs/gson-2.2.4.jar')
compile files('src/main/java/libs/quickblox-android-sdk-chat-2.5.1.jar')
compile files('src/main/java/libs/quickblox-android-sdk-content-2.5.1.jar')
compile files('src/main/java/libs/quickblox-android-sdk-core-2.5.1.jar')
compile files('src/main/java/libs/quickblox-android-sdk-messages-2.5.1.jar')
compile files('src/main/java/libs/bugsense-3.5.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:design:23.+'
compile "com.splunk.mint:mint:5.0.0"
compile 'com.google.android.gms:play-services-analytics:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
}
and this is my project level gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
Edit:
when I remove global_tracker.xml
the runOnUiThread in:
import static com.google.android.gms.internal.zzir.runOnUiThread;
not know!!!

Remove the global_tracker.xml from your xml folder, as the google-services plugin will automatically add all the required data from the google-services.json configuration file when building your app.

Related

Not able to generate signed apk. duplicate entry: DragAndDropPermissionsCompat.class

While generating a signed apk I am experiencing this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v13/view/DragAndDropPermissionsCompat.class
One of the reference link said to update the dependencies so I did but still no help.
My gradle dependencies looks like:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.google.firebase:firebase-auth:11.6.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.android.gms:play-services-auth:11.6.0'
compile 'com.google.android.gms:play-services-places:11.6.0'
compile 'com.google.android.gms:play-services-ads:11.6.0'
compile 'com.google.android.gms:play-services-maps:11.6.0'
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'agency.tango.android:material-intro-screen:0.0.4'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.afollestad.material-dialogs:core:0.8.6.1'
compile 'com.afollestad.material-dialogs:commons:0.8.6.1'
compile 'com.tumblr:remember:1.0.0#aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.wang.avi:library:2.1.3'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'com.wdullaer:materialdatetimepicker:3.5.1'
compile 'com.shawnlin:number-picker:2.4.5'
compile 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.2.0'
compile 'com.kofigyan.stateprogressbar:stateprogressbar:0.0.8'
compile 'com.github.jhonnyx2012:horizontal-picker:1.0.6'
compile 'com.zhihu.android:matisse:0.4.3'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
//debugCompile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
testCompile 'junit:junit:4.12'
compile("com.github.hotchemi:permissionsdispatcher:3.2.0") {
// if you don't use android.app.Fragment you can exclude support for them
exclude module: "support-v13"
}
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:3.2.0"
}
and at my project level gradle I am doing this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
maven {
url "https://jitpack.io"
}
maven { url "https://maven.google.com" }
}
}
I did not find any help on internet other than this link but still no progress.
This answer solved it. And this article helped to resolve the error.
Update your project level build.gralde to use newer gradle tools:
classpath 'com.android.tools.build:gradle:3.1.2' // or even newer
and remove this:
classpath 'com.google.gms:google-services:3.1.0'
lastly update your buildToolsVersion to 26.0.3
exit Android studio, clean, rebuild :)

Error: fix the version conflict (google-services plugin 11.6.0)

Im trying to use GoogleSignIn for an app but I cant resolve this issue. I read that to use GoogleSignIn class you should use the e 'com.google.android.gms:play-services-auth:11.6.0' version so I updated my gradle to this:
dependencies {
implementation 'com.google.firebase:firebase-messaging:10.2.6'
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.crystal:crystalrangeseekbar:1.0.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.estimote:sdk:0.11.0#aar'
compile 'com.google.code.gson:gson:2.7'
compile 'com.facebook.android:facebook-android-sdk:4.23.0'
compile 'com.google.android.gms:play-services-maps:11.6.0'
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'com.google.android.gms:play-services-auth:11.6.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'com.gtomato.android.library:carouselview:2.0.1'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.google.gms:google-services:3.2.0'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.github.bumptech.glide:glide:4.0.0-RC1'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
}
But I have the same mistake over and over again. Any idea about how to solve it? Also I have this btw.
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.0'
}}
The message:
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.6.0.
You should use the same version for the google play service libraries and firebase libraries.
Change:
implementation 'com.google.firebase:firebase-messaging:10.2.6'
with
implementation 'com.google.firebase:firebase-messaging:11.6.0'

java.lang.NoSuchMethodError: No static method zzcx(Landroid/content

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
testCompile 'junit:junit:4.12'
Friends Help me to solve this error..enter image description here
Add this rule in your build.gradle
compile 'com.google.firebase:firebase-analytics:10.0.1'
For latest version
Add this rule in your build.gradle
compile 'com.google.firebase:firebase-analytics:11.4.2'
And change all your firebase dependency version to 11.4.2
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
Make sure that you added these rules to your root-level build.gradle
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.1.1' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}

ZipExcepton: duplicate entry: com/google/android/gms/internal/zzpi.class

I am running into this issue every time I am trying to run my project.
I am getting this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzpi.class
Here is my build script:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.15.2'
}
}
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/commons-collections4-4.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/graphview-3.1.jar')
testCompile 'junit:junit:4.12'
compile project(':progresslibrary')
compile files('libs/gson-2.6.2.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.6.2#aar') {
transitive = true;
}
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2'
compile 'com.android.support:multidex:1.0.0'
compile 'com.hrules:charter:1.4.0'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.2'
//noinspection GradleCompatible
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15'
compile 'com.android.support:multidex:1.0.0'
compile 'com.hrules:charter:1.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.15'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.2'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.+'
compile 'eu.the4thfloor.volley:com.android.volley:2015.05.28'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.snappydb:snappydb-lib:0.5.2'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.wdullaer:materialdatetimepicker:2.2.0'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.shamanland:fab:0.0.8'
compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'org.jsoup:jsoup:1.9.1'
compile 'com.flurry.android:analytics:6.2.0'
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.github.danielemaddaluno.androidupdatechecker:library:1.0.2'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
}
android {
packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
}
apply plugin: 'build-announcements'
please tell me what is wrong with my build script
At a quick glance, I can tell you that the problem exists in Google Play Services. And I am going to guess that these all need to be the same version (grouped by same version here).
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
In order to efficiently do that, you can define an ext block in you Gradle file for keeping the version numbers consistent.
Additional note: This line compile fileTree(include: ['*.jar'], dir: 'libs')... It says compile all JAR files in the libs/ directory, therefore, these lines are pointless, and you can remove them while you try to identify where the error occurs.
compile files('libs/commons-collections4-4.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/graphview-3.1.jar')
compile files('libs/gson-2.6.2.jar')
Sample build.gradle
ext {
// Variables to keep libraries consistent
supportLibrary = "23.2.0"
googlePlayServicesVersion = '9.4.0'
// Support Libraries dependencies
supportDependencies = [
design : "com.android.support:design:${supportLibrary}",
recyclerView : "com.android.support:recyclerview-v7:${supportLibrary}",
cardView : "com.android.support:cardview-v7:${supportLibrary}",
appCompatV7 : "com.android.support:appcompat-v7:${supportLibrary}"
]
googlePlayServicesDepends = [
analytics : "com.google.android.gms:play-services-analytics:${googlePlayServicesVersion}"
plus : "com.google.android.gms:play-services-plus:${googlePlayServicesVersion}"
location : "com.google.android.gms:play-services-location:${googlePlayServicesVersion}"
fitness : "com.google.android.gms:play-services-fitness:${googlePlayServicesVersion}"
appindexing : "com.google.android.gms:play-services-appindexing:${googlePlayServicesVersion}"
auth : "com.google.android.gms:play-services-auth:${googlePlayServicesVersion}"
gcm : "com.google.android.gms:play-services-gcm:${googlePlayServicesVersion}"
]
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// compile supportDependencies.appCompatV7
// compile supportDependencies.recyclerView
// recommended - includes those above
compile supportDependencies.design
// extras
compile supportDependencies.cardView
// The correct Volley library
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile "com.google.code.gson:gson:2.6.2"
// Google Play Services
compile googlePlayServicesDepends.location
// TODO: Add others
}

Unresolved reference: kotlinx - Kotlin 1-0-0-rc-1036

I'm working in an Android App and a few days ago I updated my Kotlin version from 1.0.0-beta-1103 to the release candidate 1.0.0-rc-1036 and now I can't run my app for something related to Kotlin Android Extensions.
I use the apply plugin: 'kotlin-android-extensions' just like the official blog says http://blog.jetbrains.com/kotlin/2016/02/kotlin-1-0-release-candidate-is-out/ but my app doesn't recognize any view from any layout.
This is what appears on the console:
Error:(20, 8) Unresolved reference: kotlinx
Error:Execution failed for task ':app:compileDebugKotlin'.
Compilation error. See log for more details
Please help me, I'm losing my mind!
Update:
This is my buildScript in globalbuild.gradle
buildscript {
ext {
kotlin_version = "1.0.0-rc-1036"
}
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
The dependencies listed in the app build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Google
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
// Kotlin
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// Square
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
// ReactiveX
compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'com.jakewharton.rxbinding:rxbinding:0.3.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.2.0'
// DBFlow
kapt 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
compile "com.raizlabs.android:DBFlow-Core:2.2.1"
compile "com.raizlabs.android:DBFlow:2.2.1"
// Otros
compile 'de.hdodenhof:circleimageview:1.3.0'
// SQLite Assets Helper
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true
}
}
This is an import that I'm using:
import kotlinx.android.synthetic.main.activity_all_quizzes.*
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
should be defined in the project-local build.gradle file for now.
Your kotlin stdlib compile dependency should (at least while not stable) be the same as the kotlin android studio plugin version
...
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
...
buildscript {
ext.kotlin_version = '1.0.0-rc-1036'
...

Categories

Resources