My previous play service version is 6.5.87 and I upgraded to 7.0.0 then Got this error
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'C:\Program Files\Java\jdkx.x.x_xx\bin\java.exe'' finished with
non-zero exit value 2
compile 'com.google.android.gms:play-services:6.5.87'
I have upgraded play service Then....Now my gradle is
dependencies {
compile project(':com_facebook_android')
compile project(':pullToRefreshLib')
compile project(':smoothProgressbarLib')
compile project(':progressMaterial')
compile 'com.android.support:support-v4:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.jakewharton:butterknife:6.1.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/google-api-client-1.4.1-beta.jar')
compile files('libs/google-api-client-googleapis-1.4.1-beta.jar')
compile files('libs/jackson-core-asl-1.6.7.jar')
compile files('libs/jeval.jar')
compile files('libs/jscience.jar')
compile files('libs/libGoogleAnalyticsV2.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/guava-r09.jar')
Is there any conflict library?
No one answered. I found.... The solution is multidex
public class MyApplication extends MultiDexApplication {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
in menifest file
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:largeHeap="true"
android:theme="#style/Theme.MyAppTheme">
My gradle file
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.winapp"
minSdkVersion 14
targetSdkVersion 21
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
dexOptions {
preDexLibraries = false
incremental true
javaMaxHeapSize "4g"
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
}
You will be able to include to your gradle only Google Play Services API that you will use. In this link you should select the URIs to compile in your project https://developers.google.com/android/guides/setup#split
For example, if you would include only Google analytics you should add only this in your gradle project file
compile 'com.google.android.gms:play-services-analytics:8.1.0'
Related
I have mentioned my gradle below please let me know what is the solution for that question and have used the api level 25 in my project
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
signingConfigs {
config {
keyAlias 'yaksha'
keyPassword '123456'
storeFile file('/home/abhinav/Downloads/yaksha.jks')
storePassword '123456'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.tene.yaksha"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
testApplicationId "com.tene.yaksha1"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
testHandleProfiling true
testFunctionalTest true
}
testOptions {
reportDir "$rootDir/test-reports"
resultsDir "$rootDir/test-results"
}
dataBinding {
enabled = true
}
dexOptions {
//incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g"
}
lintOptions {
// lintConfig file("$project.rootDir/tools/rules-lint.xml")
abortOnError false
htmlOutput file("$project.buildDir/outputs/lint/lint.html")
warningsAsErrors false
xmlReport true
}
buildTypes {
release {
minifyEnabled true
debuggable false
jniDebuggable true
signingConfig signingConfigs.config
renderscriptDebuggable true
shrinkResources true
proguardFile '/home/abhinav/Android/Sdk/tools/proguard/yakshaproguard.txt'
}
debug {
minifyEnabled false
proguardFile '/home/abhinav/Android/Sdk/tools/proguard/yakshaproguard.txt'
multiDexKeepFile file('multidex-config.txt')
}
}
packagingOptions
{
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
testOptions {
unitTests.returnDefaultValues = true
unitTests {
all {
jvmArgs '-XX:MaxPermSize=256m'
if (it.name == 'testDebug') {
systemProperty 'debug', 'true'
}
if (it.name == 'connectedDebugAndroidTest') {
}
}
}
}
configurations {
}
}
dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services:10.2.1'
compile project(':realmtenedbservice')
compile project(':tenewsrestlib')
compile project(':TeneLocationLib')
compile project(':SecurityYsc')
compile project(':library')
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.birbit:android-priority-jobqueue:2.0.1'
compile 'com.fasterxml.jackson.core:jackson-core:2.7.3'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'
compile 'io.reactivex:rxjava:1.1.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.google.maps.android:android-maps-utils:0.4+'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'io.realm:android-adapters:1.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.sromku:simple-storage:1.2.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'joda-time:joda-time:2.9.7'
compile 'id.zelory:compressor:1.0.4'
compile 'io.reactivex:rxandroid:1.2.1'
}
I'm getting this error while running the project,can you anybody give suggesions why this is coming
Information:Gradle tasks [:app:assembleDebug]
Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/commons/io/CopyUtils.class
Information:BUILD FAILED
Information:Total time: 18.768 secs
Information:1 error
Information:1 warning
Information:See complete output in console
You can exclude that class, which is showing duplicate like as
configurations {
all*.exclude group: 'org.apache.commons'
}
I thik this is duplicate
compile 'com.android.support:multidex:1.0.1'
After updating to gradle 2.10 every time when I try to assemble debug build of the app I get the NoSuchMethodError exception. Here is the relevant part of the build log:
java.lang.RuntimeException: failure, see logs for details.
cannot generate view binders java.lang.NoSuchMethodError: com.google.common.base.Strings.isNullOrEmpty(Ljava/lang/String;)Z
at android.databinding.tool.util.StringUtils.capitalize(StringUtils.java:57)
at android.databinding.tool.util.ParserHelper.toClassName(ParserHelper.java:23)
at android.databinding.tool.store.ResourceBundle$LayoutFileBundle.getFullBindingClass(ResourceBundle.java:551)
at android.databinding.tool.store.ResourceBundle$LayoutFileBundle.getBindingClassPackage(ResourceBundle.java:541)
at android.databinding.tool.CompilerChef.pushClassesToAnalyzer(CompilerChef.java:124)
at android.databinding.tool.CompilerChef.createChef(CompilerChef.java:73)
at android.databinding.annotationprocessor.ProcessExpressions.writeResourceBundle(ProcessExpressions.java:148)
at android.databinding.annotationprocessor.ProcessExpressions.onHandleStep(ProcessExpressions.java:82)
at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.runStep(ProcessDataBinding.java:154)
at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.access$000(ProcessDataBinding.java:139)
at android.databinding.annotationprocessor.ProcessDataBinding.process(ProcessDataBinding.java:66)
As you can see Method com.google.common.base.Strings.isNullOrEmpty can't be found.
Some specifics
I use Retrolambda 3.2.5 and Java 8. There are no other extra plugins.
Build plugin version: com.android.tools.build:gradle:2.0.0
Build tools version: 23.0.3
OS: OS X
build.gradle looks like this. I altered it slightly to not expose some private stuff, but problem is still there.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
}
}
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
project.version = '1.0.0'
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += "--set-max-idx-number=50000" // default 60000
}
}
def googleApiKey = "key goes here"
def appVersionCode = 1
def appVersionName = project.version + "." + appVersionCode
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
manifestPlaceholders = [googleApiKey : googleApiKey,
appVersionCode: appVersionCode,
appVersionName: appVersionName]
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
"App-${project.version}-${appVersionCode}.apk"
)
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
flavorDimensions "multidex", "leakcanary"
productFlavors {
withLeakCanary {
dimension "leakcanary"
}
withoutLeakCanary {
dimension "leakcanary"
}
develDex {
dimension "multidex"
minSdkVersion 21
targetSdkVersion 23
}
prodDex {
dimension "multidex"
minSdkVersion 15
targetSdkVersion 23
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
lintOptions {
abortOnError false
}
sourceSets {
main {
jniLibs.srcDir 'build/jniLibs'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
dataBinding {
enabled = true
}
}
task copyNativeLibs(type: Copy) {
from(new File(buildDir, 'intermediates/exploded-aar/')) {
include '**/*.so'
exclude '**/lib-detector.so'
}
into new File(buildDir, 'jniLibs')
eachFile { details ->
def pathSplit = details.path.split('/')
details.path = pathSplit[pathSplit.length - 2] + '/' + pathSplit[pathSplit.length - 1]
}
includeEmptyDirs = false
}
tasks.withType(JavaCompile) { javaCompileTask -> javaCompileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
dependencies {
testCompile 'junit:junit:4.11'
testCompile 'org.robolectric:robolectric:3.0'
testCompile 'org.robolectric:shadows-multidex:3.0'
testCompile('org.robolectric:shadows-httpclient:3.0') {
exclude module: 'httpcore'
exclude module: 'commons-codec'
}
testCompile 'org.powermock:powermock-module-junit4:1.5.2'
testCompile 'org.powermock:powermock-api-mockito:1.5.2'
testCompile 'org.roboguice:roboguice:3.0.1'
compile 'com.parse.bolts:bolts-android:1.2.1'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile 'com.google.android.gms:play-services-drive:7.8.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-annotations:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'org.roboguice:roboguice:3.0.1'
provided 'org.roboguice:roboblender:3.0.1'
compile('com.google.inject.extensions:guice-assistedinject:3.0') {
exclude group: 'com.google.inject', module: 'guice'
}
compile 'commons-io:commons-io:2.4'
compile 'commons-lang:commons-lang:2.6'
compile 'com.intellij:annotations:12.0'
compile 'com.google.zxing:core:3.2.1'
compile 'com.google.zxing:android-core:3.2.1'
compile 'com.google.android.gms:play-services-base:7.8.0'
compile 'com.google.android.gms:play-services-location:7.8.0'
compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-analytics:7.8.0'
compile 'com.amazon:in-app-purchasing:2.0.1'
compile 'com.googlecode.libphonenumber:libphonenumber:7.0.7'
withLeakCanaryCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
compile 'com.google.android.gms:play-services-ads:7.8.0'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'io.reactivex:rxjava:1.0.14'
}
Question
Did anyone else had the same problem? How to fix it? If you need some extra information, please let me know in comments.
Have you tried the new patch on jitpack of simular issue #134 clean-build, there seemed to be something wrong with gradle import ordering you can try it with :
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.github.denis-itskovich:gradle-retrolambda:3.2.3-fix-134'
}
It looks like there is an error with a plugin after upgrading the Android Studio.
If you go in : <Android Studio Dir>/plugins/android/lib/builder-model-x.x.x.jar you may find 2 .jars. Try to delete the old version .jar and keep the new one and also clean and rebuild the project.
if the above does not work try this:
Change the version of Objectify library in the build.gradle file of your backend to 4.0b to 5.0.3 or higher if it exists.
This is may sound irrelevant but objectify 4.0b library has same classes with same package name which are present in appengine sdk like com.google.common.base.Strings.isNullOrEmpty.
when you deploy the app backend the appengine classes are overridden by objectify classes and hence when you try to call some method it is throwing error.
This is solved in objectify 5.0.+
Hope it helps as it helped me solving this issue.
When I try compiling the code, 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
'/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java''
finished with non-zero exit value 2
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.19.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.example"
minSdkVersion 14
targetSdkVersion 22
versionCode 20012
versionName '2.3.3'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
proguardFile '/My Workspace/FirstApp/proguard-android.txt'
debuggable false
multiDexEnabled true
}
debug {
minifyEnabled false
debuggable true
proguardFile '/My Workspace/FirstApp/proguard-android.txt'
}
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'LICENSE'
exclude 'license.txt'
}
productFlavors {
}
}
dependencies {
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.google.code.gson:gson:2.3.1'
compile files('libs/AF-Android-SDK-v2.3.1.17.jar')
compile 'com.squareup.okio:okio:1.4.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:design:22.2.1'
compile 'com.commonsware.cwac:anddown:0.2.+'
}
SOLUTION:
Used individual api libraries for google location services / gcm and removed the complete play service library. This reduced the dependable library methods and error got solved.
It's too general but, there are a couple of reasons why you get this error
1. Check dependencies{} in build.gradle. There must be duplicate libraries you're depending on.
More details : Check out my website
2. Enlarge heap size in build.gradle while compiling
android {
...
dexOptions{
incremental true
javaMaxHeapSize "4g"
}
}
I also faced the same problem when compiling my app but i refered this link
https://stackoverflow.com/a/22010135/5594089
it solved my issue.
if (BuildConfig.DEBUG) {
myView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// Do something
}
});
}
after modifying it like this it will work
View.OnClickListener lClickListener = new View.OnClickListener() {
#Override
public void onClick(View v) {
// Do something
}
};
if (BuildConfig.DEBUG) {
myView.setOnClickListener(lClickListener);
}
my error message is:
//Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/common/annotations/Beta;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)//
please help me to fix this
my build.gradle
//dependencies {
compile project(':appRater')
compile project(':circularImageView')
compile project(':facebookSDK')
compile project(':paperSlidingTab')
compile project(':library')
compile project(':urlImageViewHelper')
compile project(':pullToRefreshLi')
compile project(':libraries:SlidingMenu:library')
compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar')
compile files('libs/httpmime-4.2.5.jar')
compile files('libs/json-org.jar')
compile files('libs/universal-image-loader-1.9.1-with-sources.jar')
compile files('libs/WebSocket.jar')
compile files('libs/gcm.jar')
compile files('libs/applause-sdk-library-2.0.0.jar')
compile 'org.droidparts:droidparts:1.+'
compile 'joda-time:joda-time:2.3'
compile 'com.google.api-client:google-api-client:1.+'
compile 'com.google.api-client:google-api-client-android2:1.+'
compile 'com.google.http-client:google-http-client:1.+'
compile 'com.google.http-client:google-http-client-android2:1.+'
compile 'com.google.oauth-client:google-oauth-client:1.+'
compile 'com.google.code.gson:gson:2.+'
compile 'com.google.guava:guava:11.+'
compile 'com.google.http-client:google-http-client-jackson2:1.+'
compile 'com.google.protobuf:protobuf-java:2.+'
compile 'com.google.android.gms:play-services:3.+'
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 17
}
signingConfigs {
release {
if (System.getenv("GRADLE_KEYSTORE")) {
storeFile = file(System.getenv("GRADLE_KEYSTORE"))
storePassword = System.getenv("GRADLE_KEYSTORE_PASSWORD")
keyAlias = System.getenv("GRADLE_KEY_ALIAS")
keyPassword = System.getenv("GRADLE_KEY_PASSWORD")
}
}
}
buildTypes.debug {
ext.enableCrashlytics = false
}
buildTypes.release {
debuggable false
zipAlignEnabled true
minifyEnabled false
signingConfig signingConfigs.release
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
This appear when we use same library with 2 or more versions in one project. So try to find the versions of libraries in your app especially support-v4 library
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 19
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
You can use below code too , This work in mine case
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
defaultConfig {
minSdkVersion 14 //lower than 14 doesn't support multidex
targetSdkVersion 22
// Enabling multidex support.
multiDexEnabled true
}
or you can do by make an Application class
public class MyApplication extends MultiDexApplication { .. }
or
override
attachBaseContext method and call MultiDex.install().
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Otherwise (if your application does not have custom Application implementation), declare MultiDexApplication as application implementation in your AndroidManifest.xml.
<application
android:name="android.support.multidex.MultiDexApplication"
.. >
..
</application>
I am trying to get all the libraries for docx4j obtained here:
https://stackoverflow.com/a/23710079/1616685
I set up MultiDex successfully, however I get a duplicated entry error:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: org/apache/harmony/awt/internal/nls/Messages.class
as you can see there are a lot of libraries to compile... it is easy to have duplicates, is there a way to avoid from the gradle such errors?
here the gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.example.test_images"
minSdkVersion 15
targetSdkVersion 22
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/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
}
dexOptions {
preDexLibraries = false
// incremental true
javaMaxHeapSize "4g"
incremental true
}
productFlavors {
}
compileOptions {
}
}
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = false
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = false
}
}
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
dependencies {
compile ('com.android.support:multidex:1.0.0'){ exclude group: 'java.util.zip' }
compile ('com.android.support:appcompat-v7:22.2.0')
compile ('com.parse.bolts:bolts-android:1.+')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/ae-awt.jar')
compile files('libs/ae-docx4j-2.8.0-SNAPSHOT.jar')
compile files('libs/ae-jaxb-2.2.5.jar')
compile files('libs/ae-xmlgraphics-commons.jar')
compile files('libs/avalon-framework-api-4.3.1.jar')
compile files('libs/avalon-framework-impl-4.3.1.jar')
compile files('libs/commons-codec-1.3.jar')
compile files('libs/commons-io-1.3.1.jar')
compile files('libs/commons-lang-2.4.jar')
compile files('libs/commons-logging-1.1.1.jar')
compile files('libs/droidText.0.4.jar')
compile files('libs/istack-commons-runtime.jar')
compile files('libs/JAXBNamespacePrefixMapper-2.2.4.jar')
compile files('libs/jaxp-datatype.jar')
compile files('libs/log4j-1.2.15.jar')
compile files('libs/serializer-2.7.1.jar')
compile files('libs/stringtemplate-3.2.1.jar')
compile files('libs/txw2-20110809.jar')
compile files('libs/w3c-css.jar')
// compile 'com.android.support:support-annotations:22.2.0'
// compile 'com.android.support:multidex:1.0.0'
}
https://github.com/plutext/Docx4j4Android4/ is an Android Studio project; it uses Maven shade plugin to repackage org.apache.http