Cannot compile project after adding library - android

I have added today a library ( almost the same from gith but from a developer Branch where there are few things changed and I wanted to use both libraries )
After fixing everything I have tryed to run my project and 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 2
my gradle files are:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.marian.digimusicstream"
minSdkVersion 14
targetSdkVersion 22
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("org.restlet.jse:org.restlet.ext.httpclient:2.1.2") {
exclude group: 'org.restlet', module: 'jse'
exclude group: 'org.restlet.ext', module: 'ss1'
}
android {
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/ASL2.0'
exclude 'META-INF/services/org.restlet.engine.ClientHelper'
}
}
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'net.koofr:java-koofr:1.2.8'
compile 'org.apache.httpcomponents:httpclient:4.3.5'
compile 'org.restlet.jse:org.restlet.ext.jackson:2.1.2'
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.3'
compile 'com.rengwuxian.materialedittext:library:1.8.3'
compile 'com.github.navasmdc:MaterialDesign:1.+#aar'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile project(':..:ExoPlayer:library')
compile project(':..:ExoPlayerdev:libraryDev')
}
Untill now I was use library but today I added libraryDev
and in settings:
include ':app', ':..:ExoPlayer:library', ':..:ExoPlayerdev:libraryDev'
I add libraries from other projects from android studio, untill now I runned ExoPlayer in android studio but exoPlayerdev didn't that may be the problem ?

Related

How to fix this error when I run project firebase phone authentication

I use this dependencies
compile 'com.google.firebase:firebase-auth:11.4.2'
Error:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties
File1: C:\Users\Usman.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.2.2\d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b\jackson-core-2.2.2.jar
File2: D:\eRozgaar\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-basement\11.4.2\jars\classes.jar
my build.gradil is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.usman.erozgaar"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
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'
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.firebase:firebase-client-android:2.5.2+'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.android.volley:volley:1.0.0'
// compile 'com.google.firebase:firebase-core:10.0.1'
// compile 'com.firebase:firebase-ui-storage:0.6.0'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-storage:11.0.1'
}
You can try to add the following line to the bottom in your app's build.gradle, inside the android {} and below your dependencies {}.
packagingOptions {
exclude 'META-INF/maven'
}
This will remove unnecessary files during your build, which should prevent your duplicate file exception which is caused by merging your dependencies.
See: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml
Solution of my problem was
packagingOptions
{
exclude 'META-INF/maven/com.fasterxml.jackson.core/jackson-
core/pom.properties'
exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
exclude 'META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.xml'
}
duplicate file link copy from error message and past in
packagingOptions
{
exclude 'past here copied file link'
}

Android - TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzblr.class

I am trying to execute my firebase based application which is giving me following error
Update 1- I Updated multiDexEnabled to true also included packagingOptions but getting this error:
error log - Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
-> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzblr.class
My app-level build.gradle:-
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.multiplexerx.smartjournal"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
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'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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 'com.github.chyrta:AndroidOnboarder:0.7'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Makes sure that you're using the same library version for all of Firebase (and play services):
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'

Android Studio - ':app:packageAllDebugClassesForMultiDex' Duplicate entry android support v4

I get the error
"Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: android/support/v4/content/ContextCompatKitKat.class"
I am using apache jars for httpclient and android-support-v4.jar.
I am really new to this and am not sure why i am getting this error.
my build.gradle looks this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
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'
}
defaultConfig {
applicationId "com.example.petersenrr.test"
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
//compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile files('libs/android-support-v4.jar')
compile files('libs/httpclient-android-4.3.5.jar')
compile files('libs/httpclient-4.5.2.jar')
compile files('libs/httpcore-4.4.4.jar')
}
During gradle sync it is fine, just when i try to run it do i get this error.
Any help is appreciated
Thanks

Execution failed for task : app:dexDebug

When I am running my android project I got 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.7.0_80\bin\java.exe'' finished with non-zero exit value 3
I tried Build->Clean Project but in vain.Alos i tried "Sync project with gradle files" but in vain .My build.gradle file is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.sevenhorse.almabay"
// Enabling multidex support.
multiDexEnabled true
minSdkVersion 14
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.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'
}
}
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.code.gson:gson:2.2.+'
compile files('libs/google-api-client-1.19.0.jar')
//compile files('libs/google-api-client-android-1.19.0.jar')
compile files('libs/google-api-services-youtube-v3-rev124-1.19.0.jar')
compile files('libs/google-http-client-1.19.0.jar')
// compile files('libs/google-http-client-android-1.19.0.jar')
compile files('libs/google-http-client-jackson2-1.19.0.jar')
compile files('libs/google-oauth-client-1.19.0.jar')
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile files('libs/jackson-core-2.1.3.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/picasso-2.3.3.jar')
compile files('libs/universal-image-loader-1.6.1-with-src.jar')
compile files('libs/volley.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:multidex:1.0.0'
}
I have also done minifyEnabled true but not working.Please help me to fix the issue.
Don't include play services directly to build.gradle
compile 'com.google.android.gms:play-services:8.3.0'
Use only those modules of play services lib that you want for your application
For only GCM and Google Analytics for a app
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'

Android Studio return jdk Error when trying to import GSON

My Android Studio returns this error when trying to import GSon 2.3.1 into my project:
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.7.0_79\bin\java.exe'' finished with non-zero exit value 2
I know that this occures everytime I have some duplicates of libraries or something.I already tried to add mavenCentral() to my Repositories
My full app Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.marian.stream"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile("org.restlet.jse:org.restlet.ext.httpclient:2.1.2") {
exclude group: 'org.restlet', module: 'jse'
exclude group: 'org.restlet.ext', module: 'ss1'
}
android {
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/ASL2.0'
exclude 'META-INF/services/org.restlet.engine.ClientHelper'
}
}
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'net.koofr:java-koofr:1.2.8'
compile 'org.apache.httpcomponents:httpclient:4.3.5'
compile 'org.restlet.jse:org.restlet.ext.jackson:2.1.2'
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.3'
compile 'com.rengwuxian.materialedittext:library:1.8.3'
compile 'com.github.navasmdc:MaterialDesign:1.+#aar'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile project(':..:vector-compat-master:library')
compile 'com.baoyz.pullrefreshlayout:library:1.0.1'
compile('com.mikepenz:materialdrawer:3.0.9#aar') {
transitive = true
}
compile 'com.github.bmelnychuk:atv:1.2.+'
compile 'com.google.code.gson:gson:2.3.1'
}
Could you try adding this to your Gradle:
android {
....
dexOptions {
jumboMode = true
}
}

Categories

Resources