Appium/Selenium TestNG Gradle DexArchiveBulderException构建错误 [英] Appium/Selenium TestNG Gradle DexArchiveBulderException Build Errors
问题描述
我是中级测试人员,目前正在研究移动自动化的选项.我熟悉Appium/Selenium,现在正尝试引入TestNG来管理测试套件.
I am an intermediate level tester who is currently exploring options for mobile automation. I am familiar with Appium/Selenium and am now attempting to introduce TestNG to manage test suites.
尝试构建一个简单的项目以开始使用TestNG和Appium/Selenium进行移动测试时,我遇到了错误.我无法弄清楚该错误的解决方法.
I have run into an error when attempting to build a simple project to begin mobile testing using TestNG and Appium/Selenium. I am unable to figure out how to fix this error.
这是我的build.gradle:
Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.mikejohnson.testngtest"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9' // added this to resolve initial build conflict
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'org.testng:testng:6.11' //added this
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'org.seleniumhq.selenium:selenium-java:3.7.1' //added this
implementation 'io.appium:java-client:5.0.4' //added this
}
这是错误:
Information:Gradle tasks [clean, :app:assembleDebug]
Warning:Ignoring InnerClasses attribute for an anonymous inner class
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Mike.Johnson\.gradle\caches\modules-2\files-2.1\org.seleniumhq.selenium\selenium-firefox-driver\3.7.1\460c39abe149b7c649dd05dd71ab64ca80f738aa\selenium-firefox-driver-3.7.1.jar
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing org/openqa/selenium/firefox/FirefoxBinary.class
Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Mike.Johnson\.gradle\caches\modules-2\files-2.1\org.seleniumhq.selenium\selenium-firefox-driver\3.7.1\460c39abe149b7c649dd05dd71ab64ca80f738aa\selenium-firefox-driver-3.7.1.jar
Information:BUILD FAILED in 10s
Information:4 errors
Information:1 warning
Information:See complete output in console
要达到这一点,我要做的就是创建一个基本的android项目,并尝试将TestNG和Appium/Selenium所需的依赖项添加到build.gradle
To get to this point all I have done is create a basic android project and attempted to add the required dependencies for TestNG and Appium/Selenium to build.gradle
结合TestNG和Appium/Selenium的依赖项时会引入错误.该项目仅使用TestNG依赖关系或仅Appium/Selenium依赖关系就能够成功构建.一旦将TestNG与Appium/Selenium结合使用,就会开始出现错误.
The errors are introduced when combining the dependencies for TestNG and Appium/Selenium. The project is able to successfully build with just TestNG dependencies, or just Appium/Selenium dependencies. As soon as I combine TestNG along with Appium/Selenium, errors begin to appear.
我已经搜索并尝试了许多可能的解决方案,但是它总是以DexArchiveBulderException结尾.我没有经验来推断依赖关系出了什么问题,并且在搜索时"DexArchiveBuilderException"上的信息很少.
I have searched and tried many possible solutions, however it always ends with a DexArchiveBulderException. I do not have the experience to deduce what is going wrong with the dependencies, and there is very little information available on 'DexArchiveBuilderException' when searching.
如果我可以提供其他信息,请告诉我.谢谢您的提前帮助.
If there is any other information I can provide, please let me know. Thank you for the assistance in advance.
推荐答案
问题已修复-在Intellij IDEA中作为基本gradle/java项目重新创建了项目.
Problem fixed - recreated project in Intellij IDEA as a basic gradle/java project.
这篇关于Appium/Selenium TestNG Gradle DexArchiveBulderException构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!