Gebish on Android - android

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.

Related

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'?

Am getting en error while try to run the project
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$PrintHelperStubImpl.class
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.codecanyon.khalyil"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
ndk {
moduleName "player_shared"
}
dexOptions {
javaMaxHeapSize "4g"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
main {
jni.srcDirs = []
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:10.2.6'
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')
compile 'com.android.support:multidex:1.0.1'
}
i tried by cleaning the project
Build - > Clean
after that rebuild, But no effect
The i sync and clean the project, still no result.
Finally i click on 'build apk', but the issue still exciting.
Can any one please help me
The problem here is that you have a class that is included in two dependencies. This is most likely the v4 support lib. Check if one of your dependencies dont include the v4 support library which you already include yourself. You can exclude a dependency this way:
compile ('com.somesdk:sdk:1.3.5#aar') {
transitive=true //you dont need this if you use jars or non-aar dependencies
exclude group: 'com.android.support'
}

Why is app:assembleDebug called twice?

Why is app:assembleDebug called twice during my builds?
My app consists of two modules, the application module app and a library module commons. When I click ‘run’ in Android Studio to deploy the app on the device, I see this happening:
The bottom bar says Gradle build using tasks: [:app:assembleDebug, :commons:assembleDebug]. The blue progress bar is slowly filled. No output in the Gradle Console.
At 100% progress, I get the notification Compilation completed succesfully in 3m. Yay! At this point I expect the app to be installed.
The bar is stuck at 100%. For a moment I read something like executing post-compile tasks, and then Executing tasks: [:app:assembleDebug].
:app:assembleDebug is called again and takes some other 3 mins, while we are stuck at 100%. This time the Gradle Console logs output.
The app is installed.
Why is this? Not using Instant Run, though the same thing applies.
gradle.properties
org.gradle.jvmargs=-Xmx2560M
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.daemon=true
project level build.grade
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
ext {
compileSdkVersion = 25
buildToolsVersion = "25.0.2"
minSdkVersion = 15
targetSdkVersion = 25
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app module build.grade
apply plugin: 'com.android.application'
android {
dexOptions {
preDexLibraries true
javaMaxHeapSize "2g"
}
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.package.id"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
signingConfig signingConfigs.release_config
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
}
debug {
minifyEnabled false
shrinkResources false
}
}
productFlavors {}
}
dependencies {
compile 'com.google.maps.android:android-maps-utils:0.4.3'
compile 'com.google.android.gms:play-services-maps:9.2.1'
compile 'com.google.android.gms:play-services-appinvite:9.2.1'
compile 'com.google.android.gms:play-services-location:9.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.2.1'
compile 'com.google.android.gms:play-services-places:9.2.1'
compile ('com.facebook.android:facebook-android-sdk:4.16.1') {
exclude module: 'bolts-tasks'
}
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:preference-v14:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.parse.bolts:bolts-tasks:1.4.0'
compile 'com.parse:parse-android:1.14.0'
compile ('com.parse:parseui-widget-android:0.0.1') {
exclude module: 'parse-android'
}
compile project(':commons')
}
apply plugin: 'com.google.gms.google-services’
OK, somehow I had this in my run configuration:
After removing Make, I am back to sane compilation behavior. I wonder why I had that extra make though.

TransformException while building a project

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"

duplicate entry: android/support/v4/graphics/drawable/DrawableCompatHoneycomb.class

After changing minimum sdk to 16 i've got that error
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/graphics/drawable/DrawableCompatHoneycomb.class
this is my build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.nicoleiesperida.crazyjeepney"
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Application.mk'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile 'com.google.android.gms:play-services:+'
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')
compile 'com.facebook.android:facebook-android-sdk:4.+'
}
The same class is being provided by two different dependencies. run
gradle app:dependencies
or
./gradlew app:dependencies
where app is the app project name. Then locate the support v4 package and exclude it from the dependency. Probably it's facebook.

Android Studio 0.5.3 android.compileSdkVersion is missing

I'm using Android studio 0.5.3
I keep getting :
Gradle 'OpenBook' project refresh failed:
Cause: android.compileSdkVersion is missing!
Gradle settings
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
sourceSets {
main {
manifest.srcFile '/MyApp/src/main/AndroidManifest.xml'
}
}
}
And My App Buid.gradle
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
sourceSets {
main {
manifest.srcFile '/src/main/AndroidManifest.xml'
}
}
}
dependencies {
// compile 'com.android.support:appcompat-v7:+'
compile project("libraries:library-toast")
compile project("libraries:Volley")
compile project("libraries:actionbarsherlock")
compile project("libraries:Dialoglibrary")
compile project("libraries:google-play-services_lib")
compile project("libraries:PullToRefreshlibrary")
compile project("libraries:facebook")
compile project("libraries:SlidingTabBarlibrary")
compile project("libraries:AndroidPlot-Core")
compile project("libraries:SignUpModule")
compile project("libraries:Jars")
compile project("libraries:UpdateChecker")
compile "com.mixpanel.android:mixpanel-android:4.0.0#aar"
}
Not Sure what to do.
Thanks for any help
You have specified "compileSdkVersion 19" in your build file. Seems like you are missing that SDK (can you post more of the output with the error in it) You need to make sure that you have installed the right SDK using the SDK manager in Android Studio.
Jake Wharton has created a new gradle plugin to automatically keep the SDKs updated https://github.com/JakeWharton/sdk-manager-plugin

Categories

Resources