- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在 android studio 0.8.1 和 gradle 上有一个正在运行的项目,运行没有任何问题,但是如果我尝试在我的项目中运行一些测试,我会收到以下错误:
Error:Execution failed for task ':app:dexDebugTest'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\Leonardo\AppData\Local\Android\android-studio\sdk\build-tools\android-4.4W\dx.bat --dex --num-threads=4 --output C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\dex\test\debug C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\classes\test\debug C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\dependency-cache\test\debug C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\ant-1.8.0-90f6540aeb424fece79cbcf5a9c142d1639370bb.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\ant-launcher-1.8.0-75752524e2cfe22e800164221abdcac48de27e2a.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\asm-5.0.1-c8cc57fa69d410715b92ec859560fc814d01d95e.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\asm-analysis-5.0.1-5442ee256c0f3632ab4b32a9a5fce82929bf4069.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\asm-commons-5.0.1-588ac8e1b7216878c1af3260f5fcdf5d99cff8ab.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\asm-tree-5.0.1-553326de7527bdbeb7b59518b73b9137e3d8d2f2.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\asm-util-5.0.1-ef2fad64c577c021e5a15f4437224e32e26eff9f.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\backport-util-concurrent-3.1-c889acaff21236987cfa34814d3d0b09322c08c6.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\classworlds-1.1-alpha-2-eb45cc5ebd3a72fe080272e80fe74214a835c2c6.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\commons-codec-1.3-383c4836f0e583f6ca4687555474bce80fb4b8c3.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\fest-android-1.0.8-4accc48dc10f44e67648da9dc2ddcd9df6c55670.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\fest-assert-core-2.0M10-afffd97c0da2a18452675e26a71819f699a2315c.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\fest-reflect-1.4.1-eccad0370faa987892a231eea79a7c5832d4ae20.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\fest-util-1.2.5-918956ab9a2c5b7bbed411cd7e866c4eb9228ce3.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\hamcrest-core-1.3-a89084788a49a921a7573b5efa8ff29f99a11459.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\junit-4.11-8cb426b6ecb53ec20b0fd767afeff8c7c31fe904.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-ant-tasks-2.1.3-b289572b8b55f16a8213e9081b7a4ccf1e92897c.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-artifact-2.2.1-431ffca03ac082aa829dd81bee45bfd754938ed4.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-artifact-manager-2.2.1-26381e227ec6a84aadc833b5c8423cec957e7b21.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-error-diagnostics-2.2.1-eda257a68ef2aa2b97b5d6e7fa29cb2b6cf778bc.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-model-2.2.1-c09ac5e8d9c4980f10a653344c24daec764957dd.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-plugin-registry-2.2.1-f9ee3e8636fcd92ab0e1cb3c0df032e07b4c903c.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-profile-2.2.1-3b1a36de8b8cf219b16f24c849c640b1fea16957.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-project-2.2.1-025981ae0201c9218005a49f76f8db2665d4c6c3.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-repository-metadata-2.2.1-fc67127094027c65ff3efabc7e1ff0e0d59027e8.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\maven-settings-2.2.1-651f9aa0ee6954e89848478f6fa6dfddc415606e.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\nekohtml-1.9.6.2-2d990a336f175c6d5760c4daff597f1a99d786ed.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\objenesis-1.3-aab47089b8da4c8da409dbaa4b6f43f2e7ff30fe.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\plexus-container-default-1.0-alpha-9-stable-1-3718ce6697ffbab29c91a5005c51b90bd917ee89.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\plexus-interpolation-1.11-ba3a36ccb9ddc80b02f887e8b5622467a601500a.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\plexus-utils-1.5.15-5f0d70d8950e358a32f6416566aa6438053ee765.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\robolectric-2.3-18ca41a9e98eb103e8c01cba2475df1e45375079.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\sqlite4java-0.282-30dcf2ef4dc673dfed67e316239ce0eaf092252e.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\support-v4-19.1.0-7f265a1ac05f41075f3ac1607c1e7f354051ec1a.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\vtd-xml-2.11-22208f24be860db5223884581f94dd21b5abfcf4.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\wagon-file-1.0-beta-6-ae669046a35b6d27a65c553a273b2259399ea893.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\wagon-http-lightweight-1.0-beta-6-74abcd81bf7e536d42eefda098b0aab377f67f99.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\wagon-http-shared-1.0-beta-6-cd7b2e8f527a7b0f8892019e03b4423fd2aaf4c7.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\wagon-provider-api-1.0-beta-6-68a307c3b5f4b360aec40e10498ce9deb274f9bf.jar C:\Users\Leonardo\AndroidstudioProjects\mymoney\app\build\intermediates\pre-dexed\test\debug\xercesMinimal-1.9.6.2-1c278ddb859c5724499c536c95ce4228b229abc1.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/codehaus/classworlds/BytesURLConnection;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
我的 build.gradle 看起来像:
buildscript {
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
classpath 'org.robolectric:robolectric-gradle-plugin:0.11.+'
}
}
allprojects {
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
}
apply plugin: 'android'
apply plugin: 'robolectric'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.maddogs.mymoney"
minSdkVersion 8
targetSdkVersion 19
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
androidTest.setRoot('src/test') //note that this is androidTest instead of instrumentTest
}
}
dependencies {
compile files('libs/crashlytics.jar')
//compile 'com.squareup.dagger:dagger-compiler:1.2.1'
compile('de.keyboardsurfer.android.widget:crouton:1.8.4@aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
androidTestCompile 'junit:junit:4.11'
androidTestCompile 'org.robolectric:robolectric:2.3+'
androidTestCompile 'com.squareup:fest-android:1.0.+'
compile 'com.android.support:appcompat-v7:20.+'
compile 'de.greenrobot:eventbus:2.2.1'
compile 'com.path:android-priority-jobqueue:1.1.2'
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'com.squareup:otto:1.3.4'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.google.android.gms:play-services:3.1.+'
compile 'com.squareup.dagger:dagger:1.2.1'
compile 'com.jakewharton:butterknife:5.1.1'
compile 'com.android.support:support-v4:19.+'
}
有什么想法吗?如果你们需要更多代码,请告诉我!谢谢
最佳答案
尝试用这个替换你的 androidTestCompile 'org.robolectric:robolectric:2.3+'
。
androidTestCompile('org.robolectric:robolectric:2.3') {
exclude module: 'classworlds'
exclude module: 'maven-artifact'
exclude module: 'maven-artifact-manager'
exclude module: 'maven-error-diagnostics'
exclude module: 'maven-model'
exclude module: 'maven-plugin-registry'
exclude module: 'maven-profile'
exclude module: 'maven-project'
exclude module: 'maven-settings'
exclude module: 'nekohtml'
exclude module: 'plexus-container-default'
exclude module: 'plexus-interpolation'
exclude module: 'plexus-utils'
exclude module: 'wagon-file'
exclude module: 'wagon-http-lightweight'
exclude module: 'wagon-http-shared'
exclude module: 'wagon-provider-api'
}
关于android - 在 Android Studio 上测试 Robolectric 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24836445/
SQLite、Content provider 和 Shared Preference 之间的所有已知区别。 但我想知道什么时候需要根据情况使用 SQLite 或 Content Provider 或
警告:我正在使用一个我无法完全控制的后端,所以我正在努力解决 Backbone 中的一些注意事项,这些注意事项可能在其他地方更好地解决......不幸的是,我别无选择,只能在这里处理它们! 所以,我的
我一整天都在挣扎。我的预输入搜索表达式与远程 json 数据完美配合。但是当我尝试使用相同的 json 数据作为预取数据时,建议为空。点击第一个标志后,我收到预定义消息“无法找到任何内容...”,结果
我正在制作一个模拟 NHL 选秀彩票的程序,其中屏幕右侧应该有一个 JTextField,并且在左侧绘制弹跳的选秀球。我创建了一个名为 Ball 的类,它实现了 Runnable,并在我的主 Draf
这个问题已经有答案了: How can I calculate a time span in Java and format the output? (18 个回答) 已关闭 9 年前。 这是我的代码
我有一个 ASP.NET Web API 应用程序在我的本地 IIS 实例上运行。 Web 应用程序配置有 CORS。我调用的 Web API 方法类似于: [POST("/API/{foo}/{ba
我将用户输入的时间和日期作为: DatePicker dp = (DatePicker) findViewById(R.id.datePicker); TimePicker tp = (TimePic
放宽“邻居”的标准是否足够,或者是否有其他标准行动可以采取? 最佳答案 如果所有相邻解决方案都是 Tabu,则听起来您的 Tabu 列表的大小太长或您的释放策略太严格。一个好的 Tabu 列表长度是
我正在阅读来自 cppreference 的代码示例: #include #include #include #include template void print_queue(T& q)
我快疯了,我试图理解工具提示的行为,但没有成功。 1. 第一个问题是当我尝试通过插件(按钮 1)在点击事件中使用它时 -> 如果您转到 Fiddle,您会在“内容”内看到该函数' 每次点击都会调用该属
我在功能组件中有以下代码: const [ folder, setFolder ] = useState([]); const folderData = useContext(FolderContex
我在使用预签名网址和 AFNetworking 3.0 从 S3 获取图像时遇到问题。我可以使用 NSMutableURLRequest 和 NSURLSession 获取图像,但是当我使用 AFHT
我正在使用 Oracle ojdbc 12 和 Java 8 处理 Oracle UCP 管理器的问题。当 UCP 池启动失败时,我希望关闭它创建的连接。 当池初始化期间遇到 ORA-02391:超过
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 9 年前。 Improve
引用这个plunker: https://plnkr.co/edit/GWsbdDWVvBYNMqyxzlLY?p=preview 我在 styles.css 文件和 src/app.ts 文件中指定
为什么我的条形这么细?我尝试将宽度设置为 1,它们变得非常厚。我不知道还能尝试什么。默认厚度为 0.8,这是应该的样子吗? import matplotlib.pyplot as plt import
当我编写时,查询按预期执行: SELECT id, day2.count - day1.count AS diff FROM day1 NATURAL JOIN day2; 但我真正想要的是右连接。当
我有以下时间数据: 0 08/01/16 13:07:46,335437 1 18/02/16 08:40:40,565575 2 14/01/16 22:2
一些背景知识 -我的 NodeJS 服务器在端口 3001 上运行,我的 React 应用程序在端口 3000 上运行。我在 React 应用程序 package.json 中设置了一个代理来代理对端
我面临着一个愚蠢的问题。我试图在我的 Angular 应用程序中延迟加载我的图像,我已经尝试过这个2: 但是他们都设置了 src attr 而不是 data-src,我在这里遗漏了什么吗?保留 d
我是一名优秀的程序员,十分优秀!