java-client icon indicating copy to clipboard operation
java-client copied to clipboard

Android studio can't build

Open pxr89 opened this issue 5 years ago • 8 comments

Duplicate class org.openqa.selenium.SearchContext found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.WebDriver found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.WebDriver$ImeHandler found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.WebDriver$Navigation found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.WebDriver$Options found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.WebDriver$TargetLocator found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.WebDriver$Timeouts found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.WebDriver$Window found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.WebElement found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.internal.FindsByClassName found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.internal.FindsByCssSelector found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.internal.FindsById found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.internal.FindsByLinkText found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.internal.FindsByName found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.internal.FindsByTagName found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59) Duplicate class org.openqa.selenium.internal.FindsByXPath found in modules java-client-7.2.0.jar (com.github.appium:java-client:7.2.0) and selenium-api-3.141.59.jar (org.seleniumhq.selenium:selenium-api:3.141.59)

pxr89 avatar Oct 23 '19 09:10 pxr89

gradle config:

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.cmcm.vase.appium"
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
    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 'com.github.appium:java-client:7.2.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}

pxr89 avatar Oct 23 '19 09:10 pxr89

anyone has some idea?

pxr89 avatar Oct 23 '19 09:10 pxr89

I got the same issue. Didn't find any solution yet

ebycloudins avatar Nov 13 '19 07:11 ebycloudins

i have faced similar issue with Android studio, and even speak with maintainer (Srinivasan) of this library. and found out they do not use android studio or intelli j to test or build this library. so to use this library i made a seperate branch which contains test cases only and sync the gradle only as build is always failed, i even tired excluding some of internal dependencies of this libraries to resolve the conflict but some of selinium and other library are tightly coupled and i guess are base of this library. hence to

fix this issue only sync gradle , --> then start appium server --> then run script directly on terminal

. it worked. also currently using 7.2.0 version as there are some issues are live on 7.3.0 .

abhishekgargx avatar Mar 19 '20 09:03 abhishekgargx

@Abhishekgarg727 when you say run script directly on terminal, you mean building the APK and the executing on the device? because it doesn't work either

zsamora avatar May 08 '20 05:05 zsamora

@pxr89 @zsamora @ebycloudins @Abhishekgarg727 @jarib found the solution here - https://www.youtube.com/watch?v=sAWDy3UHSZY

TheOnlyRoshan avatar Apr 02 '21 10:04 TheOnlyRoshan

@pxr89 Is the issue resolved?

PawandeepKaur2405 avatar Apr 11 '21 14:04 PawandeepKaur2405

This fixed "Duplicate class org.openqa.selenium.SearchContext" for me:

TLDR: open java-client jar, remove those classes.

https://www.youtube.com/watch?v=sAWDy3UHSZY

HaxThePlanet avatar May 19 '21 22:05 HaxThePlanet