Good Day i am doing FireBase Cloud Notification and i will be getting
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/zza.class
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "aminfocraft.harsh.firebasenotificationdemo"
minSdkVersion 15
multiDexEnabled true
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
apply plugin: 'com.google.gms.google-services'
compile 'com.google.firebase:firebase-messaging:10.2.1'
}
./gradlew clean also not working
Problem 1
call apply plugin properly
Problem 2
Add play-services:10.2.1
Try this way
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "aminfocraft.harsh.firebasenotificationdemo"
minSdkVersion 15
multiDexEnabled true
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
}
apply plugin: 'com.google.gms.google-services'
should be outside of dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
}
apply plugin: 'com.google.gms.google-services'
this:
apply plugin: 'com.google.gms.google-services'
should be outside of dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
}
apply plugin: 'com.google.gms.google-services'
Also you forgot to add the play services dependencies..
add compile 'com.google.android.gms:play-services:10.2.1'
apply plugin: 'com.google.gms.google-services'
should be outside of dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
}
apply plugin: 'com.google.gms.google-services'
Also you forgot to add the play services dependencies..
add
compile 'com.google.android.gms:play-services:10.2.1'
Related
When I'm trying to put apply plugin: 'com.google.gms.google-services' at the bottom of my build gradle or anywhere else inside my apps build gradle I get a error say it can't find it.
Error:(70, 0) Plugin with id 'com.google.gms.google-services' not found.
Here's my gradle code so you guy's can help me figure out where to place it.
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
defaultConfig {
applicationId "com.technologx.blaze.player"
minSdkVersion 16
targetSdkVersion 24
versionCode 101
versionName "1.0 beta 1"
//renderscript support mode is not supported for 21+ with gradle version 2.0
renderscriptTargetApi 20
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
ext.enableCrashlytics = false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'MissingTranslation'
disable 'ExtraTranslation'
}
}
repositories {
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:palette-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:percent:24.2.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.firebase:firebase-ads:10.0.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'net.steamcrafted:materialiconlib:1.0.3'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.google.code.gson:gson:2.3'
compile 'de.Maxr1998:track-selector-lib:1.1'
compile 'com.afollestad.material-dialogs:core:0.9.0.2'
compile 'com.afollestad.material-dialogs:commons:0.9.0.2'
compile 'com.anjlab.android.iab.v3:library:1.0.+'
compile('com.github.naman14:app-theme-engine:0.5.2#aar') {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
I think you also need this in your projects gradle file:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
Following is my Gradle File. Its Working On Marshmallow But Its not Working On KitKat 4.2.2. It returns the following error when I run it on Kitkat.
Exception while inflating <vector>
12-21 17:45:46.235 12303-12303/com.xyz.packagename E/VdcInflateDelegate: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0
AppCompact is not supporting for the App. If i use Activity instead of Appcompact then it works fine but i need to use AppCompact because integration of Material Design Things.
apply plugin: 'com.android.application'
android
{
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig
{
applicationId "com.xyz.projectName"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes
{
release
{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies
{
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
// multidex
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
// Map
//compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.maps.android:android-maps-utils:0.3+'
//Firebase
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
Please help.
By Adding below line it work fine for me
aaptOptions {
additionalParameters "--no-version-vectors"
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.xyz.project name"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
/* vectorDrawables.useSupportLibrary = true
generatedDensities = []*/
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// important to run code on kitkat
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
// multidex
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
// ImageLoader
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
// Map
//compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.maps.android:android-maps-utils:0.3+'
// Spinner
compile 'com.jaredrummler:material-spinner:1.1.0'
// Volley
compile 'com.android.volley:volley:1.0.0'
//Firebase
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
//CropImage
compile project(':CropImage')
}
apply plugin: 'com.google.gms.google-services'
I am trying to integrate firebase into my android app, but I am receiving this error:
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzrs.class
This is my app level build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.evan.scout"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.instabug.library:instabug:2.3.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.firebase:firebase-database:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-config:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
I do not even see a zzrs.class file
Thanks
try this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.instabug.library:instabug:2.3.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.firebase:firebase-database:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-config:9.4.0'
exclude group: 'com.google.android.gms'
}
I am facing this error:
Failed to resolve--compile 'com.android.firebase:firebase-storage:9.0.0'
Here is the app gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.kartik.barcode"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.0.2#aar'
compile 'com.google.zxing:core:3.2.0'
compile 'com.android.support:design:23.2.1'//for The edittext animation
compile 'com.google.firebase:firebase-database:9.0.0'//for firebase
compile 'com.google.firebase:firebase-auth:9.0.0'
compile 'com.android.firebase:firebase-storage:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
Here is the SDK Tool Tab
Change:
compile 'com.android.firebase:firebase-storage:9.0.0'
to:
compile 'com.google.firebase:firebase-storage:9.0.0'
I am trying to open new android project, then i will get an error the error is,
Failed to resolve:junit:junit:4.12
Error(23,13)
please help me to fix it.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.akhil.myapplication"
minSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
}
Remove compile 'junit:junit:4.12' from the build.gradle file.
so the finally code look like this
Code :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
}
comment out junit dependency and then rebbuild the project.