Can't generate signed apk but it works fine - android

I can run the app and I can use it, but I can't generate signed apk. Here is the log and debug apk is running on some devices only.
Error:Execution failed for task
':app:transformClassesWithJarMergingForRelease'.com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/gson/annotations/Expose.class
Here is my app.gradle.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
//apply plugin: 'com.google.gms.google-services'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
compileOptions.encoding = 'UTF-8'
signingConfigs {
}
repositories {
//jcenter()
mavenCentral()
maven {
url 'http://repo.brightcove.com/releases'
}
}
defaultConfig {
applicationId "com.asd.asd"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
manifestPlaceholders = [partner: "asd"]
multiDexEnabled = true
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
buildTypes {
debug {
buildConfigField 'boolean', 'IS_ENABLE_ADS', 'true'
signingConfig signingConfigs.debug
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile(name: 'MfsAndroidLibrary', ext: 'aar')
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.android.support:percent:25.1.1'
//compile 'com.android.support:design:22.2.0'
compile files('libs/gson-2.2.4.jar')
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
compile 'com.afollestad.material-dialogs:commons:0.9.3.0'
compile 'com.brightcove.player:exoplayer:4.+'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.useinsider:insider:6.0.8'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.pitt.fresh.library:freshdownloadview:1.0'
//compile 'cn.pedant.sweetalert:library:1.3'
// compile 'com.tkurimura:flickabledialog:0.9.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.jetbrains:annotations-java5:15.0'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0#aar'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.google.android.gms:play-services-analytics:10.0.1'
compile 'org.jsoup:jsoup:1.7.3'
compile 'com.afollestad:sectioned-recyclerview:0.2.3'
compile 'com.tonicartos:superslim:0.4.13'
//for select birthday
compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
//image libraries
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.useinsider:insider:6.1.7'
compile 'com.wang.avi:library:1.0.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'io.card:android-sdk:5.3.0'
compile 'com.bkm.bexandroidsdk:bexandroidsdk:1.1.2'
}
apply plugin: 'com.google.gms.google-services'
and root gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
flatDir{
dirs 'libs'
}
maven { url "http://mobile.useinsider.com" }
maven { url 'https://dl.bintray.com/bkmexpress/maven' }
maven {
url "https://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

I deleted this line
compile files('libs/gson-2.2.4.jar')
added this code and it works
compile ('com.google.code.gson:gson:2.7'){
transitive = true;
exclude module: 'gson'
}

Related

how to solve Multiple dex files define Lcom/google/android/gms/measurement/AppMeasurement;

This is our Build gradle Module:APP
how to solve Multiple dex files define Lcom/google/android/gms/measurement/AppMeasurement problem please give me some solution all the dependcies are given below so there is play-services and google-services as well so give me solution for
repositories {
maven { url "https://jitpack.io" }
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
dexOptions {
jumboMode = true
preDexLibraries = false
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
configurations{
all*.exclude module:'gson' //Remove duplicate dependencies: gson
}
}
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 fileTree(include: ['*.jar'], dir: 'libs')
compile project(':lib')
compile project(':tablayoutsupport')
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:multidex:1.0.3'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
compile 'com.anthonycr.grant:permissions:1.0'
compile 'com.auron:permission-manage:1.1.6'
compile 'com.github.andyxialm:ColorDialog:1.0.0'
compile 'com.anjlab.android.iab.v3:library:1.0.44'
compile ('com.google.firebase:firebase-core:11.0.2'){
force = true;
}
compile ('com.google.android.gms:play-services:8.4.0'){
force = true;
exclude module: 'support-v4'
}
compile 'com.squareup.picasso:picasso:2.71828'
compile ('com.google.firebase:firebase-messaging:17.3.4') {
force = true;
}
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile ('com.google.code.gson:gson:2.8.5'){
force=true;
}
compile 'org.apache.commons:commons-lang3:3.5'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
and this is build.gradle (project)
so tell me what is solution of this eror how i install it sucessfully
Top-level build file where you can add configuration options common to all sub-projects/modules.
and this build.gradle and app is not running so what is the solutions
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51"
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
google()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Error:Execution failed for task ':app:compileRetrolambdaDebug' - After Firebase integration

I am creating an application with the support of Retrolambda & RxJava2. Everything works fine until I needed to implement push notification functionality. I have configured firebase in my application, since then the execution failed with below error message.
Error:Execution failed for task ':app:transformClassesWithRetrolambdaForDebug'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
Top Level Build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Application level Build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.solver.inventory"
minSdkVersion 21
targetSdkVersion 25
versionCode 2
versionName "Beta V2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
multiDexEnabled true
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
//Use “exclude” to point at the specific file (or files) that Android Studio is complaining about//
exclude 'META-INF/rxjava.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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(name: 'aficustomprint', ext: 'aar')
compile('com.github.KingsMentor:MobileVisionBarcodeScanner:v1.2') { transitive = true; }
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
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.android.support:design:25.3.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.mcxiaoke.volley:library:1.0.6'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.4.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
repositories {
flatDir {
dirs 'libs'
}
maven { url 'https://maven.fabric.io/public' }
}
retrolambda {
javaVersion JavaVersion.VERSION_1_7
jvmArgs '-noverify'
defaultMethods false
incremental true
}
apply plugin: 'com.google.gms.google-services'
Everything works fine again if I remove the firebase from my application. Please help me out of this.

Error while run app in Android Studio. app:incrementalDebugJavaCompilationSafeguard

Error:Execution failed for task ':app:incrementalDebugJavaCompilationSafeguard'.
java.io.IOException: Could not delete folder
C:\Users\XXXX\AndroidStudioProjects\XXXX\app\build\intermediates\classes\debug\com\bluejamesbond
Its a fresh instaltion of Android Studio en Windows 8 and the app was running after that but in Windows 7.
My gradles
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.5'
}
}
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.XXX.XXX"
minSdkVersion 15
targetSdkVersion 23
versionCode 23
versionName "1.9.6"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':volley')
compile('com.github.worker8:tourguide:1.0.16-SNAPSHOT#aar') { transitive = true }
compile('com.crashlytics.sdk.android:crashlytics:2.6.0#aar') { transitive = true; }
compile 'com.github.bluejamesbond:textjustify-android:2.1.6'
compile 'com.bignerdranch.android:expandablerecyclerview:2.1.1'
compile 'com.github.clans:fab:1.6.2'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'com.sothree.slidinguppanel:library:3.2.1'
compile 'io.card:android-sdk:5.3.4'
compile 'com.github.techery:ProperRatingBar:v0.0.3'
compile ('com.mercadopago:sdk:BETA_WORKSHOP#aar') { transitive = true }
compile 'com.android.support:palette-v7:24.0.0'
compile 'com.github.arimorty:floatingsearchview:2.0.1'
compile ('com.lamudi.phonefield:phone-field:0.0.8#aar') { transitive = true }
compile 'com.android.support:support-vector-drawable:24.0.0'
compile 'com.android.support:animated-vector-drawable:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.google.android.gms:play-services-gcm:9.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.google.android.gms:play-services-appindexing:9.2.0'
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.android.gms:play-services-auth:9.2.0'
compile 'com.google.maps.android:android-maps-utils:0.4.1'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
Thanks!
I have this problem after moving my project folder. I solve it by cleaning it.
Build>Clean Project, then rebuild it Build>Rebuild Project.

java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions exception in API 19

My Android app is running on Android Lollipop and Marshmallow version but when i run it on API 19 it gives exception
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions exception
I am not using any firebase in may application. I search some related problem on Internet and apply in my app but right now i could not found any solution. Please help me
below is my top gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
below is my app gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.dp.needdepartmentalstore"
minSdkVersion 14
targetSdkVersion 23
versionCode 29
versionName "5.16"
multiDexEnabled true
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "16c778cf-8ebc-47a8-9ba8-6815f0223a0e",
onesignal_google_project_number: "253919422974"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile('com.mikepenz:actionitembadge:3.1.8#aar') {
transitive = true
}
compile('com.weiwangcn.betterspinner:library-material:1.1.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile project(':niceSpinner')
compile files('libs/PGSDK_v1.0.jar')
compile files('libs/App42_ANDROID_SDK_3.8.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile('com.instabug.library:instabugsupport:1+') {
exclude group: 'com.mcxiaoke.volley', module: 'library'
}
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.bignerdranch.android:expandablerecyclerview:2.0.3'
compile 'com.marshalchen.ultimaterecyclerview:library:0.3.18'
compile 'com.miguelcatalan:materialsearchview:1.3.0'
compile 'com.wdullaer:materialdatetimepicker:2.0.2'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.google.android.gms:play-services-analytics:9.0.0'
//compile 'com.onesignal:OneSignal:2.+#aar'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.intuit.sdp:sdp-android:1.0.2'
compile 'com.google.android.gms:play-services-maps:9.0.0'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'

after adding google-services.json also i am getting error like

GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
this is my project gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'maven-publish'
apply plugin: "java"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha5'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier "sources"
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar
pom.withXml {
asNode().appendNode('description', 'A demonstration of Maven POM customization')
}
}
}
}
this is my app.gardle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/universal-image-loader-1.9.5.jar')
compile project(':databaseAutoCompleteLibrary')
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:gridlayout-v7:23.2.0'
compile project(':MPChartLib')
compile project(':filechooserlibrary')
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v13:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'
compile project(':Volley')
compile 'com.google.code.gson:gson:2.4'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'milyn:opencsv:1.6'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:multidex:1.0.1'
}
Apply this in your app build.gradle file
apply plugin: 'com.google.gms.google-services'
dependencies {
compile 'com.google.android.gms:play-services:8.3.0'
}
In your project build.gradle define
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}
allprojects {
repositories {
jcenter()
}
}

Categories

Resources