android - 添加Appium依赖关系后出现Gradle构建错误

标签 android android-studio appium

我希望使用appium进行自动化测试(我使用的是Android Studio for dev)。我为appium添加了gradle依赖关系,但是由于出现以下警告和非零退出错误,我无法运行该应用程序。

Warning:Dependency org.apache.httpcomponents:httpclient:4.4.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages


错误为:

> Error:Execution failed for task ':app:preDexDebug'.
> java.lang.IllegalArgumentException: Source
> D:\Learning\GDLearning\app\build\intermediates\pre-dexed\debug\websocket-client-9.2.11.v20150529-344b13c53e6f4871f43101e675dc9239cd9ab46b.jar
> and destination
> D:\Learning\GDLearning\app\build\intermediates\pre-dexed\debug\websocket-client-9.2.11.v20150529-344b13c53e6f4871f43101e675dc9239cd9ab46b.jar
> must be different


我的build.gradle文件是:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.example.gdlearning"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }
    packagingOptions{
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }
}


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile('com.google.api-client:google-api-client-android:1.20.0') {
        exclude group: 'org.apache.httpcomponents'
    }
    compile('com.google.apis:google-api-services-tasks:v1-rev41-1.20.0') {
        exclude group: 'org.apache.httpcomponents'
    }
    compile 'com.google.android.gms:play-services-ads:8.3.0'
    compile 'io.appium:java-client:3.2.0'
}


任何建议/帮助都将很棒!我在SO上进行了探索,尝试了一些尝试,但没有成功。

最佳答案

您无需将appium依赖项推送到您的应用程序Build.gradle文件。
您只需要按照官方页面上的说明进行操作即可。

http://appium.io/slate/en/master/?ruby#quick-start

也许您应该:

1) Download Appium
2) Setting Evironment variables (ANDROID_HOME, JAVA_HOME, ..)
3) Play with the Appium 
4) Write some test code

关于android - 添加Appium依赖关系后出现Gradle构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34036263/

相关文章:

android - 下载谷歌 API 英特尔 x86 atom 系统镜像时出错

java - 如何将具有一些辅助文件的此文件夹添加到android studio中的项目中?

java - 如何实例化 IOSDriver 以在当前 session 中访问其方法

javascript - 我是否需要在 cordova/phonegap 项目的所有 html 文件中添加 app.initialize()

android - Java BufferedImage/Android 位图

android - Gradle - Windows 中缓存库的位置

android - 如何从 APPIUM 中的脚本滚动列表

java - 如何在 ios 移动应用程序中单击可见= false 的元素

java - Android:调用 EditText getText() 方法时出现 NullPointerException

android - 如何在 Android 上构建和图像识别应用程序