Following is my build.gradle file
buildscript {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.3.0'
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.abc.def"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
generatedDensities = []
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
incremental true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
def final APP_COMPAT_VERSION = "24.0.+"
dependencies {
compile "com.android.support:design:$APP_COMPAT_VERSION"
compile 'com.android.support:cardview-v7:23.3.+'
compile 'com.android.support:support-vector-drawable:23.3.+'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:palette-v7:25.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.facebook.rebound:rebound:0.3.8'
}
Im getting the following error when I run this project
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
android/support/v4/text/BidiFormatter$1.class
I tried to build after cleaning the project. I tried to delete the build folder and rebuilt the project again but still Im getting this error. How can I be able to solve this out?
Use support libraries of the same version.
compile "com.android.support:design:$APP_COMPAT_VERSION"
compile "com.android.support:cardview-v7:$APP_COMPAT_VERSION"
compile "com.android.support:support-vector-drawable:$APP_COMPAT_VERSION"
compile "com.android.support:cardview-v7:$APP_COMPAT_VERSION"
compile "com.android.support:palette-v7:$APP_COMPAT_VERSION"
Related
I exported my Build box project and opened it on Android studio. But Unable to Build it.I'm getting this error.
Failed to resolve: appcompat-v7
Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.test.test1"
minSdkVersion 16
targetSdkVersion 26
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
implementation 'com.google.android.gms:play-services:+'
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(dir: 'libs', include: ['*.jar'])
// More deps here //
}
anyone know how to fix this ?
Add this in dependencies:
implementation 'com.android.support:appcompat-v7:27.1.1'
Add this in project gradle
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
}
Dagger 2 don't work with java 8 and Jack enabled.Try to solve this problem with different versions of dagger 2.x Didn't help. Works fine before but when I try to add Java 8 this error occurred:
Error:Execution failed for task ':app:transformJackWithJackForDebug'.
> com.android.jack.ir.JNodeInternalError: java.lang.Exception: java.lang.NoSuchMethodError: com.google.common.base.CharMatcher.whitespace()Lcom/google/common/base/CharMatcher;
App gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.test.my.project"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.google.dagger:dagger:2.5'
annotationProcessor "com.google.dagger:dagger-compiler:2.5"
compile 'com.google.android.gms:play-services-maps:10.0.1'
}
Project gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// 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
}
Charmatcher.whitespace() was introduced in Guava 19. Looks like you have some code that compiles against Guava 19, but end up with something earlier than that on the classpath.
I am trying to use retrolambda in my application but I face issues
build.gradle project
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle app
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "psystem.co.reaya"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
jackOptions {
enabled true
}
}
dexOptions {
preDexLibraries false
javaMaxHeapSize "4g"
incremental true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.code.gson:gson:2.4'
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:+'
compile 'com.android.support:multidex:1.0.1'
}
my tries to fix the issue remove jack options , I got this error `org.gradle.execution.TaskSelectionException: Task ',' not found in root project 'Reaya'.`
any one can help me to fix my issue
thank you
1.update the Android studio to 2.1 or higher version;
2.delete the "apply plugin: 'me.tatarka.retrolambda'"
Try it!
removing the lines apply plugin: 'me.tatarka.retrolambda' worked for me.
Might stick to retrolambda. Some discussions on jack can be found here
i tried to run my app in avd but when i select to run the gradle turn an exception :
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Library dex files are not supported in multi-dex mode
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 2
my app is synced successfully when i sync it but on running time!
this is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ir.esfandune.material"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
preDexLibraries = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
compile project(':material-dialogs')
compile files('lib/glide-3.6.1- 3f8a822297969bbac00507aeca83271794f037ca.jar')
//compile files('lib/de.hdodenhof/circleimageview/1.3.0/jars/classes.jar')
}
and this is my other module gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ir.esfandune.material"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
preDexLibraries = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
compile project(':material-dialogs')
compile files('lib/glide-3.6.1-3f8a822297969bbac00507aeca83271794f037ca.jar')
}
i searched for fix this error on stackoverflow and google but didnt find any useful answer!
is that any one that can help me plz?
check all your libraries you use, including dependencies of the libraries and make sure there are no conflicting versions.
open terminal from Android Stodio and type in: "./gradlew clean"
build again
im currently trying to add gebish into my project. I added the dependencies in my build.gradle, but it says :
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/services/org.codehaus.groovy.transform.ASTTransformation
File1: C:\Users\Muco\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-all\2.4.5\1730f61e9c9e59fd1b814371265334d7be0b8d2\groovy-all-2.4.5.jar
File2: C:\Users\Muco\.gradle\caches\modules-2\files-2.1\org.gebish\geb-ast\0.13.1\ad8ac4809edf1964636ca2817e48d447c4c0c15b\geb-ast-0.13.1.jar
File3: C:\Users\Muco\.gradle\caches\modules-2\files-2.1\org.gebish\geb-implicit-assertions\0.13.1\ecfb15862e11eaa6b7e1b8179dc60621ae0ff5a\geb-implicit-assertions-0.13.1.jar
I often had "duplicate" problems, but i can't solve this one. What's the best i can do in this kind of situations? I mean i just do what the Doc says and copy-paste, but i get these errors.
build.gradle
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.muco.staemme"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile "org.gebish:geb-core:0.13.1"
compile "org.seleniumhq.selenium:selenium-firefox-driver:2.52.0"
compile "org.seleniumhq.selenium:selenium-support:2.52.0"
}
I just had to add
android.packagingOptions {
exclude 'META-INF/services/org.codehaus.groovy.transform.ASTTransformation'
exclude 'META-INF/LICENSE.txt'
}
and now it works.