简体   繁体   中英

how to add selenium to android project

hi im trying to add selenium to my android studio app but i keep getting error

Caused by: java.lang.VerifyError: org.openqa.selenium.htmlunit.HtmlUnitDriver

i have selenium added to project structor and my grade dependencies are

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile files('libs/selenium-java-2.47.1-srcs.jar')
    compile files('libs/selenium-java-2.47.1.jar')
    compile files('libs/htmlunit-2.17.jar')
    compile files('libs/htmlunit-core-js-2.17.jar')
}

i have tryed adding all jars from selenium lib folder but this causes the gradle build time to be approx ten min and then it just crashes anyone have any ideas on how to add selenium I norm use netbeans where you can just create a library and dump a folder of jars in so i might just be doing something really stupid

when all dependencies are added this is the error i get

Information:Gradle tasks [:app:assembleDebug]

:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:collectDebugMultiDexComponents
:app:packageAllDebugClassesForMultiDex
:app:shrinkDebugMultiDexComponents
:app:createDebugMainDexClassList FAILED
Error:Execution failed for task ':app:createDebugMainDexClassList'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 21.207 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

a! the min sdk version for multiDex must be greater than 14 so in gradle build

minSdkVersion 14

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM