Issue with facebook sdk and itextg - android

In my proyect I have this dependecies:
compile ('com.twitter.sdk.android:twitter:2.2.0#aar'){
transitive=true;
}
compile 'com.google.android.gms:play-services-maps:11.2.0'
compile 'com.google.android.gms:play-services-auth:11.2.0'
compile 'com.itextpdf:itextg:5.5.10'
compile 'com.nightonke:boommenu:2.1.0'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
twitter and google are used to sign up a new user, but if I want to add facebook using com.facebook.android:facebook-android-sdk:[4,5) dependency, appears this error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: Cannot merge new index 70800 into a non-jumbo instruction!
I also notice that if I delete
compile 'com.itextpdf:itextg:5.5.10'
The error never appears, but I need that dependency!!
I found that this happends while there are too much strings or something like that, and It can be fixed by adding
dexOptions {
jumboMode = true
}
But the compile time increase!!
So, why that happend if facebook is independent of itext?
and how to fix that issue without delete something or adding dexOption or even without adding multidex option?

Related

generate signed APK error : java.util.zip.ZipException

I use my samsung A5 for testing app and the project is working correctly on my phone, but not working on other phones. so I want to Generate signed APK from my project. but there was an exception error:
Error:Execution failed for task '::transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/daimajia/androidanimations/library/BaseViewAnimator;
I googled the error and these code remove that error:
multiDexEnabled true
and
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
but now there is another exception:
Error:Execution failed for task ':transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/daimajia/androidanimations/library/BaseViewAnimator.class
I think this might be because of libraries that I use, but have no idea how to handle it. below is all libraries in build.gradle :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
//for compiling card view
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
//for sticky header
compile 'com.github.carlonzo.stikkyheader:core:0.0.3-SNAPSHOT'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.melnykov:floatingactionbutton:1.0.7'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1#aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1#aar'
compile 'me.drakeet.materialdialog:library:1.3.1'
compile files('libs/volley.jar')
compile 'com.daimajia.easing:library:1.0.1#aar'
compile 'com.daimajia.androidanimations:library:1.1.3#aar'
//Sweet Alert Dialog
compile 'cn.pedant.sweetalert:library:1.3'
compile 'org.apmem.tools:layouts:1.10#aar'
}
A few things...
First of all, I'd remove most of the 3rd party libraries you are including. For example,
//for sticky header
compile 'com.github.carlonzo.stikkyheader:core:0.0.3-SNAPSHOT'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.melnykov:floatingactionbutton:1.0.7'
all of those are covered by the Design Support Library from Google
From the names I think you can also remove
compile 'com.ogaclejapan.smarttablayout:library:1.6.1#aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1#aar'
compile files('libs/volley.jar') should be replaced with compile 'com.android.volley:volley:1.0.0'
and I'd also remove
//Sweet Alert Dialog
compile 'cn.pedant.sweetalert:library:1.3'
compile 'org.apmem.tools:layouts:1.10#aar'
Many of those projects you are including haven't been worked on in over 2 years.
Try to still with the support libraries from Google. You'll get most of this from the Design support library.
Last point. You are getting the Dex errors because the app is including all of these libraries and passing the 64k method limit. I suggest enabling proguard to remove un-used code and reduce the method count of your project.

Not able to generate signed apk. Proguard throwing error

I am successfully able to generate the debug apk of my Android app. But while generating a signed version I get the message:
Warning:there were 1 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task
':app:transformClassesAndResourcesWithProguardForRelease'.
java.io.IOException: Please correct the above warnings first.
Following is the list of my project dependencies:
dependencies {
compile 'ch.acra:acra:4.5.0'
compile project(':androidHorizontalListView')
compile 'cz.msebera.android:httpclient:4.4.1.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.android.support:design:24.0.0'
compile 'com.github.danylovolokh:hashtag-helper:1.1.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
}
methodscount.com shows, that Acra (v 4.5.0) depends on:
org.json:json:20080701
You have two choices:
Update Acra to version 4.7.0
or
Add this dependency

Facebook SDK causing 'appDebug' error android studio

I am trying to incorporate Facebook SDK , but Android Studio is giving me errors at compile time.
Here is my error:
Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 2
Gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gcm.jar')
compile files('libs/httpmime-4.1.1.jar')
compile files('libs/junit-4.10.jar')
compile files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar')
compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/signpost-jetty6-1.2.1.1.jar')
compile files('libs/twitter4j-core-3.0.5.jar')
compile project(':stripe')
compile project(':FacebookSDK')
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.intuit.sdp:sdp-android:1.0.3'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.specyci:residemenu:1.6+'
compile 'com.android.support:multidex:1.0.0'
}
But this doesn't work, and honestly isn't a good solution. When I remove facebook sdk, my app compiles no problem, but with it nothing works. What am I missing here?
You are over 64K methods in your build because of using so many libraries, enable multiDex, clear unused libraries, remove unused methods with ProGuard or whatever you want, but you have reached the method count limit for a single APK.

How to resolve : more than one library with the package name com.google.android.gms in gradle

How to resolve this error while compiling google play service gcm and admob.
Error:Execution failed for task ':processDebugResources'.
Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0[enter image description here][1]
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.code.gson:gson:2.3'
compile "com.android.support:appcompat-v7:22.2.1"
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
This will probably vanish if you use the same version on both (7.8.0)
compile 'com.google.android.gms:play-services-gcm:7.8.0' // <- remove this line
compile 'com.google.android.gms:play-services:6.5.87'
There is already 8.1+ though.
Also:
Gcm is already in the play services, you can remove the whole line.

ExecException when adding the new support design library

I'm trying to add the new Support Design library to my project:
compile 'com.android.support:design:22.2.0'
But as soon as I try to compile, I get the following error:
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_40\bin\java.exe'' finished with non-zero exit value 3
I've already reached the 65k method limit a few libraries back, so I already added MultiDex support and solver that problem a while ago.
Here are all my dependencies, if it helps:
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.jpardogo.materialtabstrip:library:1.0.9'
compile('com.crashlytics.sdk.android:crashlytics:2.2.2#aar') {
transitive = true;
}
compile 'com.helpshift:android-aar:3.8.0'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.github.kierans:ViewPagerIndicator:138e5f5bd9'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.balysv:material-ripple:1.0.2'
compile 'it.neokree:MaterialNavigationDrawer:1.3.3'
compile 'pl.charmas.android:android-reactive-location:0.6#aar'
compile 'io.reactivex:rxjava:1.0.10'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
I know there are a lot of them, but I need them all.
You should consider changing your compile 'com.google.android.gms:play-services:7.5.0' dependency, and grab only a portion of the Play Services.
You can see the guide for it at https://developers.google.com/android/guides/setup#split , that will most likely solve your 65k issue as well.

Categories

Resources