我第一次错过了在依赖项中添加两个库
dependencies
{
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-vector-drawable:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.armcha:SpaceNavigationView:1.6.0'
implementation files('libs/byte-buddy-1.8.15.jar')
implementation files('libs/commons-exec-1.3.jar')
implementation files('libs/guava-25.0-jre.jar')
implementation files('libs/java-client-7.0.0.jar')
implementation files('libs/okhttp-3.11.0.jar')
implementation files('libs/okio-1.14.0.jar')
implementation 'com.android.support:multidex:1.0.3'
//missed
implementation files('libs/client-combined-3.141.59.jar')
implementation files('libs/client-combined-3.141.59-sources.jar')
}
然后在同步项目并获得类似错误的
AGPBI: {"kind":"error","text":"Program type already present: org.openqa.selenium.WebDriver$Window","sources":[{}],"tool":"D8"}
Error: Program type already present: org.openqa.selenium.WebDriver$ImeHandler
当我添加“Appium Jar files for Java”插件(Java-client-7.0.0.Jar)时,我检查它是否已经包含“最新的Appium客户端库”(selenium-Java-3.141.59)中包含的类,如internet上的一些教程所述。
要解决此问题,请执行以下操作:
-
-
用7zip打开java-client-7.0.0.jar并删除“org/”文件夹和所有子文件夹。
-
在项目中包括更新的java-client-7.0.0.jar。重建项目