android - dexmaker gradle 同步失败,符号未解析
问题描述
我的 android studio 中的 gradle sync 一直失败。需要帮忙
https://github.com/linkedin/dexmaker这是我尝试使用的开源软件,名为 dexmaker。我尝试使用下载
androidTestCompile 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.21.0'
但它会出现这样的错误
Failed to resolve: com.linkedin.dexmaker:dexmaker-mockito-inline:2.21.1
我终于尝试了
androidTestCompile 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.19.1'
这有效,但在我的java代码中
问题是即使我成功同步 gradle,我仍然无法使用开源。
DexMaker dexMaker = new DexMaker();
DexMaker 得到红线,如果我点击它,它会说
cannot resolve symbol 'DexMaker'
有什么问题?
解决方案
我不确定,但据我了解您的情况:
您使用 androidTestCompile 指令添加依赖项。这意味着这个包将仅在 android 测试类中可用。为了更好地理解每个依赖项,可以通过三种方式添加:compile、testCompile 和 androidTestCompile。
- compile :在您的应用程序代码中随处可见依赖关系。
- testCompile :仅在常规测试中可用的依赖项。
- androidTestCompile :仅在 android 测试中可用的依赖项。
因此,如果您希望该依赖项在您的应用程序中可用 - 将 androidTestCompile 替换为 compile。但我不确定你应该这样做,因为该库是用于测试的。
PS 不推荐使用编译指令,您应该使用 implementation、testImplementation 和 androidTestImplementation。
推荐阅读
- rebus - Rebus 与 Azure 服务总线,订阅一个接口
- java - ProgressDialog.show() - Activity 已泄露窗口
- ios - 带有核心数据的 iOS Today 扩展
- node.js - Node.js 内置模块 readline 关闭后继续读取行
- python - Pandas DataFrame,将具有多个值的列分成多列并删除空值
- java - 为什么我们在 TreeMap 中转换为 Comparable
- html - css3,“transform: scale()”的变体不适用于除 Firefox 之外的任何浏览器
- javascript - 无法将 SCSS/CSS 文件链接到 React.js 文件
- typo3 - TYPO3 后端损坏
- excel - VBA中不同版本office的会计参考