DexArchiveMergerException only on release - android

I developed an app that uses a swagger-generated Java client. The client is in a project called "api", while the app is in a project called "app".
When I build the app via Build/Make Project everything works fine. Also, when I try to run the app on an emulated or physical device Run/Run 'app'. Running with debugger works as well. Even when I build the project via Buid/Generate Signed Bundle/APK and choose the debug option, it works.
Now. The build fails when I try to create a signed release build. The following messages show:
Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: [...]\app\build\intermediates\transforms\dexBuilder\release\54, [...]\app\build\intermediates\transforms\externalLibsDexMerger\release\0, [...]\app\build\intermediates\transforms\dexBuilder\release\52.jar, [...]\app\build\intermediates\transforms\dexBuilder\release\53.jar
Caused by: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: [...]\app\build\intermediates\transforms\dexBuilder\release\54, [...]\app\build\intermediates\transforms\externalLibsDexMerger\release\0, [...]\app\build\intermediates\transforms\dexBuilder\release\52.jar, [...]\app\build\intermediates\transforms\dexBuilder\release\53.jar
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: io.swagger.client.ApiCallback
I am pretty new to developing with Android Studio and Gradle. I tried some solutions on Stack Overflow that already suggested to add some libraries but so far none of them worked with my problem.
To me, its especially suspicious that the last error message points to io.swagger.client.ApiCallback.
Could it have anything to do with the fact that both settings.gradle for "api" and "app" have the same content? Both look like this:
rootProject.name = "swagger-java-client". This is the only line in the file, but as far as I know, the settings.gradle for "app" already hat that content. I cant remember changing it so its odd to me that it shows "swagger-java-client". Is that normal?
Update 1
ProGuard has been mentioned in the comments to might be a problem. This is the only occurrence I could find, referencing it. In my build.gradle for the "app"-project, there is this part:
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
However, removing it did not change anything.
Update 2
When searching for "io.swagger" AS only finds this:
When searhing for "io.swagger.client.ApiCallback" AS only finds this:
Update 3
As suggested, I tried adding
android {
defaultConfig {
multiDexEnabled true
}
}
and adding android.enableD8 = false but that didn't help either.
Here are my build.gradle-Files (the first ones that caused the problems, without the suggested corrections I've tried so far.)
build.gradle (Module: api) (generated by Swagger):
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'io.swagger'
version = '1.0.0'
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
repositories {
jcenter()
}
if(hasProperty('target') && target == 'android') {
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
// Rename the aar correctly
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
}
}
afterEvaluate {
android.libraryVariants.all { variant ->
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
task.description = "Create jar artifact for ${variant.name}"
task.dependsOn variant.javaCompile
task.from variant.javaCompile.destinationDir
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
artifacts.add('archives', task);
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts {
archives sourcesJar
}
} else {
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
install {
repositories.mavenInstaller {
pom.artifactId = 'swagger-java-client'
}
}
task execute(type:JavaExec) {
main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}
}
dependencies {
compile 'io.swagger:swagger-annotations:1.5.21'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.squareup.okhttp:logging-interceptor:2.7.5'
compile 'com.google.code.gson:gson:2.8.2'
compile 'org.threeten:threetenbp:1.3.5'
testCompile 'junit:junit:4.12'
}
build.gradle (Module: app):
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 28
defaultConfig {
applicationId "projectName"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "0.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation fileTree(dir: '../api/build/libs', include: ['*.jar'])
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.okhttp:okhttp:2.7.5'
api project(path: ':api')
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'org.jetbrains:annotations-java5:15.0'
}

Here are some workaround :
Can you please make sure you have multiDexEnabled set to true as shown below in your gradle settings:
android {
defaultConfig {
multiDexEnabled true
}
}
Try android.enableD8 = false in grade.properties

Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: io.swagger.client.ApiCallback
Means there are multiple dependencies contain this class, maybe different versions, so you need to exclude them.
Press shift twice, search io.swagger, then record the found jar files.
If these jar files are simply duplicated, keep 1 in build.gradle.
If these jar files are modules of other dependency, enter gradlew -q app:dependencies in the terminal, find the root dependency names.
In build.gradle, choose 1 dependency to keep, for others add exclude command.
For example change
implementation 'xxx:xxx'
to
implementation ('xxx:xxx') { exclude module 'module-name-to-be-excluded' }
UPDATE
Some options to try:
Change build variants of both modules to release, then Build\Build APK
If success, copy the text from Gradle Console.
Next Build\Generate Signed APK...
Compare the text in Gradle Console with the above one to check the difference.

I've found the answer to my question:
What I did was to create the swagger client, move the created folder into my project, adjust the settings.gradle file and the build.gradle file accordingly.
What went wrong
The way I configured things, gradle would build the ´api´ project and then the app project.
For some reason, when I configured things as release, the app project referenced the code of the api project, as well as the resulting .jar file. Thats where the Program type already present came from.
How I fixed it
Exclude the api project from the app project
Build api seperately
Take the resulting .jarfile and put it in a folder inside your app folder called libs
Put this line in your gradle dependencies for your build.gradle (Module: app): implementation fileTree(dir: 'libs', include: ['*.jar'])
This included the finished .jarfile in the appproject and now I can build release. This should be done regardless, because the swagger client shouldnt be edited anyway, as it is generated code. So even just to not always build that part of the project, this should be done.
However, I still dont fully understand why there is this difference between the releaseand the debugbuild. Would be glad for any insight to that.
EDIT: ADDITIONAL INFORMATION
I just found out: if, for some reason, I would have wanted to keep the Module: api in my project I could have done so by removing the two dependencies in my Module: appthat start with implementation fileTree.
The api-project is already included by the dependency api project(path: ':api'). The filetree-lines were the ones causing the problem here, since they were redundant.
However, still no idea why there is a difference between debug and release

Related

Failed to resolve: org.jitsi.react:jitsi-meet-sdk:3.+

I tried changing the compilesdk and mindsdk versions as told here. I read all the other posts regarding the same but none worked so far. I have looked at the previous answers ans1 and ans2 . They didn't helped.
When I try to run the project it throws multplie errors. I think the main problem is because of this one
Could not find any matches for org.jitsi.react:jitsi-meet-sdk:3.+ as no versions of org.jitsi.react:jitsi-meet-sdk are available.
build.gradle(My application)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
}
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(app)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 30
defaultConfig {
applicationId "com.example.myapplication"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-common-ktx:20.0.0'
implementation 'com.google.firebase:firebase-firestore:24.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation ('org.jitsi.react:jitsi-meet-sdk:3.+') { transitive = true }
}
Any help is appreciated.
I find a workaround for this. You've to paste the maven URL into settings.gradle file. Some other user was facing a problem similar to this here . I did the same and it's working fine.
+1 / Failed to resolve: org.jitsi.react:jitsi-meet-sdk:3.+
5 min
I had added the maven dependency in the wrong place. It goes in the project gradle, under allprojects->repositories.
new fail
A problem occurred evaluating root project 'My Application'.
Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
For me the problem was with the SDK version
I replaced this line
implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
with this line
implementation ('org.jitsi.react:jitsi-meet-sdk:5.1.0') { transitive = true }
If you are using React-Native < 0.60, you should use a version < 2.0.0.
For versions higher than 2.0.0, you need to add the following piece of code in your metro.config.js file to avoid conflicts between react-native-jitsi-meet and react-native in metro bundler.
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/ios/Pods/JitsiMeetSDK/Frameworks/JitsiMeet.framework/assets/node_modules/react-native/.*/,
]),
},
};
ref: https://github.com/skrafft/react-native-jitsi-meet

Failed Android build - unable to find Guava repository

I'm trying to compile an Android app and the Gradle build is failing. The project is in Java but does have Room code as well, which I believe is where the issue is arising from. The build is unable to find the Guava repository at www.google.com:guava:23.6-Android even though this file has been added as a dependency.
The initial result build fail looks like this:
Could not find com.google.guava:guava:23.6-android.
Required by:
project :App
The project-level build file:
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The app level build file contains the following:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.nathan.digipizza"
minSdkVersion 19
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
dataBinding true
}
}
dependencies {
implementation 'com.google.guava:guava:26.3-android'
def room_version = "2.3.0"
implementation 'androidx.appcompat:appcompat:1.4.0-rc01'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.5.0-alpha05'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-compiler:2.4.0'
implementation 'androidx.room:room-runtime:2.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
annotationProcessor 'androidx.room:room-compiler:2.3.0'
}
It is difficult to post the entire dependency tree since I'm still unable to post screen images. But the repository in question, com.google.guava:guava:23.6-android, is not listed as a dependency for any other files, and its entry in the tree for the release variant reflects this fact as it is situated furthest left on the tree as follows:
+--- com.google.guava:guava:23.6-android FAILED
This repository only appears once in the dependency tree, furthermost to the left.
The com.google.guava:guava:23.6-android repository has an updated version to 30.1-android. I did update the version, but the error remains and everything is the same as above except version 30.1-android replaces version 23.6-android.
I need to figure out how to resolve the build error, which I'll post here again for ease of use:
Could not find com.google.guava:guava:23.6-android.
Required by:
project :app
I don't understand how the build is failing to see this repository when it has been added as a dependency, and there doesn't appear to be any complications apparent by analyzing the dependency tree.

Android Firestore cannot get FirestoreInstance

I am trying to set up the Firstore API with my Android project however when I try to call FirebaseFirestore.getInstance() I get this error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.google.firebase.FirebaseApp.<clinit>(com.google.firebase:firebase-common##16.1.0:150)
at com.google.firebase.firestore.FirebaseFirestore.getInstance(com.google.firebase:firebase-firestore##18.1.0:70)
at ip.travelaid.backend.Database.<init>(Database.java:16)
at ip.travelaid.backend.CLITest.main(CLITest.java:11)
Caused by: java.lang.RuntimeException: Stub!
at android.os.Looper.getMainLooper(Looper.java:23)
at com.google.firebase.FirebaseApp$UiExecutor.<clinit>(com.google.firebase:firebase-common##16.1.0:987)
... 4 more
I have checked both my project and app level build.gradle files and they match what the documentation requires, even the Firebase Assistant in AS says that they are right. Just in case though here they are:
Module build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "ip.travelaid"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
In the Firebase Console I have set up the database to deny any read/write requests but I thought that wouldn't affect my ability to get an instance to the database.
The google-services.json file for the Firebase project is up to date, I have even tried re-downloading it from the Firebase Console to no avail.
I have tried searching for a solution online but there seem to be nothing out there on it(this could well be down to me not being able to search for the issue properly though).
Is there a setting, either in the Firebase Console or AS, that I am missing that may be causing this issue?
update compiled & target sdk like so v
compiled sdk 26
to
compiled sdk 28
Obligatory: NVM I figured it out.
The problem was that I tried to run the code from the command line and not through an Android Emulator/Device actually running the app.
When I did run it there the problem disappeared.

Lint found fatal errors while assembling a release target - gradle error?

I am using AS 3.1 with gradle-4.5-all.zip and main build.gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
An app-level build.gradle looks like following:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example"
minSdkVersion 14
targetSdkVersion 27
versionCode 6
versionName "1.00"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation 'ch.acra:acra:4.6.1'
implementation 'commons-validator:commons-validator:1.5.0'
implementation 'com.android.support:support-v13:27.1.1'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.google.zxing:core:3.3.0'
}
and works fine when I set up a debug version under AS 3.1 to my phone, but when I try to make release apk it shows me an error:
Lint found fatal errors while assembling a release target.
To proceed, either fix the issues identified by lint, or modify your build
script as follows:
...
android {
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
}
}
As I can see in the lint-results-release-fatal.html the reason is:
I would not like to change lintOptions to supress this error because it doesn't solve the problem, it just hide it. More over, when I use
implementation files('libs/commons-validator-1.5.0.jar')
instead of
implementation 'commons-validator:commons-validator:1.5.0'
the release apk is compiled without any error messages. Is it a some gradle bug or what!?
P.S. I have attached a file androidDependencies.txt. Package commons-logging doesn't appears in the dependencies at all! How is it possible to get the solution of above problem analysing this file?
the release apk is compiled without any error messages. Is it a some
gradle bug or what!?
It seems like that dependency has a package which conflicts with the Android itself. The reason why it works without implementation and adding it manually, it might be that it downloads needed packages when you add it to be downloaded from maven repository and that's when the issue came up.
Anyways, the solution at these situations might be using the latest version:
implementation 'commons-validator:commons-validator:1.6'
Or, exclude it as follows:
implementation ('commons-validator:commons-validator:1.5.0') {
exclude group: 'commons-logging', module: 'commons-logging'
}
Note: The following part can't be helpful (for this issue) since the error says:
Commons-logging defines classes that conflict with classes now
provided by Android
You could go deeply by running ./gradlew app:dependencies in the IDE terminal to see which one conflicts with the Android itself and then excluding it as above.

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1

Here is the content of my build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
credentials {
username artifactoryUserName
password artifactoryPassword
}
url 'http://test:8081/artifactory/libs-release-local'
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
allprojects {
repositories {
maven {
credentials {
username artifactoryUserName
password artifactoryPassword
}
url 'http://test:8081/artifactory/libs-release-local'
}
mavenCentral()
maven { url 'http://repo1.maven.org/maven2' }
jcenter()
} }
Here is the content of app\build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "test.com"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
signingConfigs {
aseeConfig {
storeFile file("test.keystore")
storePassword "test123"
keyAlias "AndroidKey"
keyPassword "test123"
}
}
buildTypes {
release {
signingConfig signingConfigs.aseeConfig
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
prod.initWith(buildTypes.release)
prod {
signingConfig signingConfigs.aseeConfig
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
} }
dependencies {
//compile 'com.google.android:support-v4:r13'
compile 'com.google.android:google-play-services:4.1.32'
compile 'com.devsmart.android:devsmart-lib:1.0.0'
compile 'com.jeremyfeinstein.slidingmenu.lib:sliding-menu:1.0.0'
compile 'com.viewpagerindicator:viewpager-indicator:2.4.1'
///compile 'com.google.android.gms:google-play-services_lib:4.1.32'
compile 'com.emilsjolander:sticky-list-headers:1.0.0'
//compile 'com.actionbarsherlock:actionbar-sherlock:4.2.0'
compile 'com.mobeta.android.dslv:drag-sort-list-view:0.6.1'
compile 'com.threegvision.products:inigma_sdk_pro:3.24'
compile 'org.afree:a-free-chart:1.0.0'
compile 'org.afree:a-free-graphics:1.0.0'
compile 'net.simonvt:datepicker:1.0'
//compile 'eu.inmite:android-styled-dialogs:1.1'
compile 'com.nineoldandroids:nine-old-androids:2.4.1'
compile 'com.shinobicontrols.charts:shinobicharts:1.5.0-5'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'com.journeyapps:zxing-android-embedded:3.0.1#aar'
compile 'com.google.zxing:core:3.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/actionbarsherlock-4.2.0.jar')
compile files('libs/android-styled-dialogs-1.1.1-sources.jar')
compile files('libs/android-support-4.0.jar')
}
I can't build my project . I am getting this error:
I faced this kind of issue once but I don't remember exactly how to fix it.
As I rememeber, I follow this link
It's seem because there are many module dependent on difference support-v4 lib. So add multiDexEnabled true may works.
Also try to set all modules' dependency to a same version of support-v4. You can look at these link to known how to exclude compile v4 link1 link2 link3
If it still doesn't work, try to clean project, restart Studio, even restart your computer(I don't know why but this worked for me once)
Hope this helps.
in your build.gradle file set your compileSdkVersion 20.0.0 and buildToolsVersion "21.0.0"
Generally, it is because of resource conflicts within your modules.For sample, there are two ic_launcher.png in your app.(one from module and one from your app)
I searched to check resource conflicts but I didn't find official solution.
I only solved by this ways, remove each module and test it is being conflict or not. That's the simplest way to solve. I hope this will help you.
Here below are another suggestion....
I found also this way, one person(I didn't remember name) use safe delete to check conflict.
And some Q&A said, to add multiDexEnabled:true. That config is to increase dex file size. You can also use multidex support library .
The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536, including Android framework methods, library methods, and methods in your own code. Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration.
Here is the link for multiDex:
https://developer.android.com/tools/building/multidex.html
But documentation said you should be careful to use that.

Categories

Resources