Error: Program type already present: org.openqa.se

2019-03-31 20:58发布

I'm trying to set up Appium with Android Studio and encounter loads of errors. I'm using the open source app Omni-Notes and if I include the necessary dependencies via the maven repository, I get the following error:

Execution failed for task ':omniNotes:transformDexArchiveWithExternalLibsDexMergerForFossDebug'.

Program type already present: org.openqa.selenium.WebDriver$ImeHandler

Sometimes it's the ImeHandler, but other times WebDriver$Options.

These are the versions I'm using:

compile group: 'io.appium', name: 'java-client', version: '6.0.0-BETA1'
compile group:  'org.seleniumhq.selenium', name: 'selenium-java', version: '3.8.1'

I've tried things like cleaning the project, deleting .gradle, adding multidexenabled etc.

Would really appreciate any help.

1条回答
Juvenile、少年°
2楼-- · 2019-03-31 21:49

When I add the "Appium Jar files for Java" plugin (java-client-7.0.0.jar) I checked that it already contains the classes contained in the "Latest Appium Client Library" (selenium-java-3.141.59) as described in some tutorials on the internet.

To solve the problem do:

  1. Delete the java-client-7.0.0.jar file from your project

  2. Open java-client-7.0.0.jar with 7zip and delete the "org /" folder and all subfolders.

  3. Include the updated java-client-7.0.0.jar in your project. Rebuild project

查看更多
登录 后发表回答