简体   繁体   English

gradle和robolectric升级后的资源$ NotFoundException google_play_services_version

[英]Resources$NotFoundException google_play_services_version after gradle and robolectric upgrade

I am attempting to update a project to Gradle 3.0.1 / gradle wrapper 4.1. 我正在尝试将项目更新为Gradle 3.0.1 / gradle wrapper 4.1。 Robolectric tests that used to work are now failing when run with ./gradlew testDebugUnitTest : 当使用./gradlew testDebugUnitTest运行时,过去工作的Robolectric测试现在失败了:

android.content.res.Resources$NotFoundException: org.odk.collect.android:integer/google_play_services_version
    at org.robolectric.android.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:72)
    at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:319)
    at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:220)
    at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:108)
    at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:35)
  • com.android.tools.build:gradle:3.0.1 com.android.tools.build:gradle:3.0.1
  • org.robolectric.robolectric:3.5.1 org.robolectric.robolectric:3.5.1
  • build tools 26.0.2 构建工具26.0.2
  • gradle wrapper 4.1 gradle wrapper 4.1

This is an open source project -- the updated configuration is available here . 这是一个开源项目 - 此处提供了更新的配置。

It doesn't seem related but just in case -- we also started seeing pmd and lint errors that we didn't before. 它似乎没有关联,但为了以防万一 - 我们也开始看到我们之前没有的pmdlint错误。 Those configs or versions haven't changed. 那些配置或版本没有改变。

I have found the following possibly related issues: 我发现了以下可能相关的问题:

None of the suggestions on those posts have helped so far. 到目前为止,关于这些职位的任何建议都没有帮助。 I've read the release notes for gradle and robolectric and am not seeing any hints. 我已经阅读了gradle和robolectric的发行说明,但没有看到任何提示。 Any idea which tool is likely to be causing the problem? 知道哪个工具可能导致问题? Any thing else I can try? 还有什么别的我可以试试吗?

Removing a @Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml", packageName = "org.odk.collect") and adding in testOptions.unitTests.includeAndroidResources true did the trick. 删除@Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml", packageName = "org.odk.collect")并在testOptions.unitTests.includeAndroidResources true添加testOptions.unitTests.includeAndroidResources true就可以了。 Full diff here . 完全差异在这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到google_play_services_version - google_play_services_version not found No Gradle - 找不到与给定名称匹配的资源('value'的值为'@ integer / google_play_services_version') - No Gradle - No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version') 测试中的Gradle Robolectric资源NotFoundException - Gradle Robolectric Resources NotFoundException in Testing 设置Google Services API后无法获取google_play_services_version值 - Can't get the google_play_services_version value after setting the google services API 错误:找不到资源整数/ google_play_services_version(又名app:integer / google_play_services_version) - error: resource integer/google_play_services_version (aka app:integer/google_play_services_version) not found 对于intellij,无法解析符号@ integer / google_play_services_version - Cannot resolve symbol @integer/google_play_services_version for intellij google_play_services_version)。 错误:处理失败 - google_play_services_version) not found. error: failed process 找不到Android清单@ integer / google_play_services_version - Android manifest @integer/google_play_services_version not found Android:找不到Admob资源@ integer / google_play_services_version - Android: Admob resource not found @integer/google_play_services_version 来自aar库的google_play_services_version值出错 - Error with google_play_services_version value from aar library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM