gpt4 book ai didi

java - Android Studio 1.3 : 'Class ref in pre-verified class resolved to unexpected implementation' error

转载 作者:太空宇宙 更新时间:2023-11-04 13:44:25 24 4
gpt4 key购买 nike

当我尝试运行测试时,我收到上述错误,因为从最新的 AndroidStudio 更新到 1.3 开始,我无法再在 gradle 构建脚本中使用“provided”关键字来表示非 jar 依赖项。

我有一个相对简单的 Gradle 构建脚本,该脚本在最新的 AndroidStudio 更新之前一直有效。

  • 主应用程序编译一个依赖于 Google Play 服务的库项目。
  • 我还有一个 Testutils 项目,仅通过主构建脚本中的“androidTestCompile”命令编译测试。该项目还依赖于 Google Play 服务。
  • 到目前为止,为了避免“预先验证的类中的类引用解析为意外实现”错误,我在 TestUtils 的 gradle 构建脚本中使用“Provided”关键字代替“compile”关键字来引用对 Google Play 服务的依赖项。
  • 从最新的 AS 更新开始,我收到以下警告,并且测试不再编译:“警告:Project TestUtils:提供的依赖项只能是 jar。 com.google.android.gms:play-services:aar:6.1.71 是一个 Android 库。

如何解决这个问题?

提前非常感谢,里兹

最佳答案

我将以下配置添加到我的应用程序级别 build.gradle 中,以从 TestUtils 的 androidTestCompile 中排除播放服务。这解决了问题:

configurations {
androidTestCompile.exclude group: 'com.google.android.gms'
androidTestCompile.exclude module: 'play-services:6.1.71'
}

关于java - Android Studio 1.3 : 'Class ref in pre-verified class resolved to unexpected implementation' error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31007845/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com