Appium/Selenium TestNG Gradle DexArchiveBulderException 构建错误 [英] Appium/Selenium TestNG Gradle DexArchiveBulderException Build Errors

查看:23
本文介绍了Appium/Selenium TestNG Gradle DexArchiveBulderException 构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名中级测试员,目前正在探索移动自动化的选项.我熟悉 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆