【问题标题】:adding sqljdbc jar in android studio throws app:transformClassesWithDexFroDebug Exception在 android studio 中添加 sqljdbc jar 会引发 app:transformClassesWithDexFroDebug 异常
【发布时间】:2016-06-15 09:32:30
【问题描述】:

在 android studio 中添加 sqljdbc jar 会引发 app:transformClassesWithDexFroDebug 异常。 我正在尝试连接到 sqlserver,因此当我删除 jar 时在 libs 文件夹中添加了 sqljdbc42.jar 一切正常,但我需要添加 jar 以实现数据库连接。请告诉我我做错了什么。

我还在Classpath中添加了sqljdbc42.jar路径的路径。

这是我的 build.gradle 应用插件:'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.test.cropin.automationtesting"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'

    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile files('libs/apache-mime4j-0.6.jar')
    compile files('libs/bsh-2.0b4.jar')
    compile files('libs/cglib-nodep-2.1_3.jar')
    compile files('libs/commons-codec-1.10.jar')
    compile files('libs/commons-exec-1.3.jar')
    compile files('libs/commons-io-2.4.jar')
    compile files('libs/commons-logging-1.2.jar')
    compile files('libs/gson-2.3.1.jar')
    compile files('libs/guava-19.0.jar')
    compile files('libs/hamcrest-core-1.3.jar')
    compile files('libs/hamcrest-library-1.3.jar')
    compile files('libs/httpclient-4.5.1.jar')
    compile files('libs/httpcore-4.4.3.jar')
    compile files('libs/httpmime-4.5.jar')
    compile files('libs/jcommander-1.48.jar')
    compile files('libs/jna-4.1.0.jar')
    compile files('libs/jna-platform-4.1.0.jar')
    compile files('libs/junit-4.12.jar')
    compile files('libs/netty-3.5.7.Final.jar')
    compile files('libs/phantomjsdriver-1.2.1.jar')
    compile files('libs/selenium-java-2.53.0.jar')
    compile files('libs/selenium-java-2.53.0-srcs.jar')
    compile files('libs/testng-6.9.9.jar')
    compile files('libs/sqljdbc42.jar')
}

【问题讨论】:

    标签: sql-server android-studio build.gradle


    【解决方案1】:

    经过反复试验,意识到要成功使用最新的 SeleniumJars 。 我将测试框架从 TestNG 更改为 Junit。

    使用 sql jar 文件路径在系统变量中设置类路径。

    通过上述更改,我能够开始使用 SQL Server 自动化我的测试用例

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-10
      • 2015-02-17
      • 1970-01-01
      • 2016-10-09
      相关资源
      最近更新 更多