Firebase messaging and Google Play service anylatics duplicate analytic - android

I tried to add Firebase messaging to use push notification and Google Play service analytics to tracking my app with google analytics. When I syns now build it is ok but when I run app it show error
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.>com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/analytics/internal/Command$1.class
I try to add Myapplication.class with
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
and add multiDexEnabled true in build, But it not work
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "hoatv.videotrailer"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
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')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
provided 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.jpardogo.materialtabstrip:library:1.1.0'
compile files('libs/valuepotion.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile 'com.github.Commit451.YouTubeExtractor:youtubeextractor:2.1.0'
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-analytics:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
How can I fix it? please help me! thanks alot!

Related

Unable to merge dex on Run Android App

i try run my application but suddenly arise this error
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
then i try searching and try that solution but all solution is not worked
help me :(
here is my .gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
defaultConfig {
applicationId 'com.inhatc.jh.yourplaylist'
minSdkVersion 20
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/jaudiotagger-2.2.4-SNAPSHOT.jar')
compile files('libs/glide-3.4.0.jar')
compile files('libs/google-api-services-youtube-v3-rev183-1.22.0.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
// Google Api Client library and Android extension
compile 'com.google.api-client:google-api-client-android:1.22.0'
// Change to the API you want to access:
// Below is just an example for People REST API access
compile 'com.google.apis:google-api-services-people:v1-rev4-1.22.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
today solved my problem
i miss lib/.jar files and .gradle dependencies

Android Error:Execution failed for task ':app:transformClassesWithDexForDebug'

I have worked in android project in android studio, When i start run gradle build and the following errors shown. Anyone help me what is the problem
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.stage.lookara"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile files('libs/twitter4j-core-4.0.4.jar')
compile files('libs/slider.jar')
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.etsy.android.grid:library:1.0.5'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile files('libs/universal-image-loader-1.9.5.jar')
compile 'com.github.darsh2:MultipleImageSelect:v0.0.3'
compile files('libs/pherialize-1.2.1.jar')
compile 'com.wang.avi:library:2.1.3'
compile 'com.mikhaellopez:circularprogressbar:1.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile
'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'com.felipecsl:gifimageview:2.1.0'
}
repositories {
jcenter()
}
dependencies {
compile 'org.adw.library:discrete-seekbar:1.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'org.jsoup:jsoup:1.7.3'
}
You are compiling the whole Google play services library:
compile 'com.google.android.gms:play-services:8.3.0'
which can cross the 64K reference limit' during compiling..
See this
if u just use some services from the library you can Selectively compiling APIs into your executable
Like:
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
I would also suggest to use latest version of play services compile 'com.google.android.gms:play-services:10.2.1'
2nd Way
If you really want to use the whole library : Enable Multidex in your application.
in your Gradle:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
in Application class:
public class MyApplication extends SomeOtherApplication {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Define the application class in manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
Try clean first.
If it does not works, add multiDexEnabled to your build.gradle file.
defaultConfig {
multiDexEnabled true
}
See this: com.android.build.transform.api.TransformException

Error while generating build apk file in my android studio

I am trying to build apk file in my android studio but it is generating the following error.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zzd.class
How to get out from this issue and build apk file.
Mygradle file code is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.wedding.weddingapp"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
configurations { all*.exclude module: 'gson-2.5' }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://raw.githubusercontent.com/layerhq/releases-android/master/releases/" }
maven { url "https://raw.githubusercontent.com/layerhq/Atlas-Android/master/releases/" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.layer.atlas:layer-atlas:0.3.6'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.volley:volley:1.0.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Its probably because you must be using older version of google services
please make sure apply plugin: 'com.google.gms.google-services'
and com.google.firebase:firebase-messaging:9.8.0 are compatible note don't use com.google.gms.google-services 9.0.0 please make sure you are using above 9.0.0 version

Pushy Integration Execution failed for task ':app:transformClassesWithJarMergingForDebug'

I am attempting to integrate Pushy (https://pushy.me/) into my app to allow for more reliable real-time notifications, in place of GCM.
However, upon attempting to run the app, the error below appears:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/fasterxml/jackson/core/base/GeneratorBase$1.class
Below is my build.gradle class:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1" // 22.0.1
defaultConfig {
applicationId "com.example.android.myapp2"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
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'
}
dataBinding {
enabled = true
}
}
dependencies {
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I have attempted to clean, rebuild, but nothing helps.
How can I alleviate this issue?
After contacting the support line, I simply needed to prevent duplicate references of the jackson library:
configurations {
all*.exclude group: 'com.fasterxml.jackson.core'
}
and changed the dependencies to:
dependencies {
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile files('libs/pushy-1.0.7.jar') //** Specified **
}

failed to find 'com.firebase:firebase-ui:0.2.0' in android studio

I want to use firebase UI in my android app, but it constantly give build error while adding dependency in `android studio
i tried the tutorial at https://github.com/firebase/FirebaseUI-Android#using-the-library-in-your-android-app and
https://www.firebase.com/blog/2015-08-27-firebaseui-makes-mobile-easy.html
But both gives me same error
here is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "re.book.bookify"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.github.shell-software:viewmover:1.1.0'
compile 'com.github.shell-software:uitools:1.1.0'
compile 'com.firebase:firebase-client-android:2.3.1+'
compile 'com.firebase:firebase-ui:0.2.0'
}
Please post your build.gradle First
Add the following lines to the dependencies object at the bottom:
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebaseui:firebase-ui:0.2.0'
Check This Instructions
https://github.com/firebase/FirebaseUI-Android#using-the-library-in-your-android-app
Thanks Frank van Puffelen, that was the exact problem.
The gradle link given at https://www.firebase.com/blog/2015-08-27-firebaseui-makes-mobile-easy.html is not correct,
The 0.2 version of FirebaseUI was published in the com.firebaseui group. So the gradle link for it is compile 'com.firebaseui:firebase-ui:0.2.0'

Categories

Resources