Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android malformed resources crashes with NoSuchMethodError #2709

Closed
aj-michael opened this issue Mar 20, 2017 · 0 comments
Closed

Android malformed resources crashes with NoSuchMethodError #2709

aj-michael opened this issue Mar 20, 2017 · 0 comments
Labels
P2 We'll consider working on this in future. (Assignee optional) type: bug

Comments

@aj-michael
Copy link
Contributor

aj-michael commented Mar 20, 2017

Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.

Description of the problem / feature request / question:

The Android rules' tools depend on //third_party:android_common_25_0_0 which contains jars that were built against Guava 17.0 (http://mvnrepository.com/artifact/com.android.tools/common/25.0.0). However, these tools depend on //third_party:guava which is Guava 21.0. This results in failures in the Android commons code at runtime.

If possible, provide a minimal example to reproduce the problem:

$ cat WORKSPACE
android_sdk_repository(name = "androidsdk")

$ cat BUILD
android_binary(
    name = "bin",
    custom_package = "foo",
    manifest = "AndroidManifest.xml",
    resource_files = ["res/values/strings.xml"],
)

$ cat AndroidManifest.xml 
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="foo" />

$ cat res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <not_string name="invalid_string">Unrecognized tag</not_string>
</resources>

$ bazel build //:bin
INFO: Found 1 target...
ERROR: /usr/local/google/home/ajmichael/playgrounds/resources-crash/BUILD:1:1: Processing Android resources for //:bin failed: Process exited with status 1 [sandboxed].
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Objects.firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
        at com.android.ide.common.res2.MergingException$Builder.build(MergingException.java:129)
        at com.google.devtools.build.android.ParsedAndroidData$Builder.checkForErrors(ParsedAndroidData.java:89)
        at com.google.devtools.build.android.ParsedAndroidData$Builder.build(ParsedAndroidData.java:98)
        at com.google.devtools.build.android.ParsedAndroidData$ParsedAndroidDataBuildingPathWalker.createParsedAndroidData(ParsedAndroidData.java:218)
        at com.google.devtools.build.android.ParsedAndroidData.from(ParsedAndroidData.java:354)
        at com.google.devtools.build.android.AndroidResourceProcessor.mergeData(AndroidResourceProcessor.java:1131)
        at com.google.devtools.build.android.AndroidResourceProcessingAction.main(AndroidResourceProcessingAction.java:248)
        at com.google.devtools.build.android.ResourceProcessorBusyBox$Tool$1.call(ResourceProcessorBusyBox.java:53)
        at com.google.devtools.build.android.ResourceProcessorBusyBox.main(ResourceProcessorBusyBox.java:137)
Use --strategy=AndroidAapt=standalone to disable sandboxing for the failing actions.
Target //:bin failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.622s, Critical Path: 0.43s

Environment info

  • Operating System:
    Ubuntu 14.04

  • Bazel version (output of bazel info release):
    release 0.4.5

Have you found anything relevant by searching the web? (e.g. GitHub issues, email threads in the bazel-discuss@googlegroups.com archive)

No

@aj-michael aj-michael added category: rules > android P2 We'll consider working on this in future. (Assignee optional) type: bug labels Mar 20, 2017
bazel-io pushed a commit that referenced this issue Mar 29, 2017
bazel-io pushed a commit that referenced this issue May 5, 2017
… tests.

Since #2709 was fixed, this CL also enables ParsedAndroidDataTest.

RELNOTES: None
PiperOrigin-RevId: 155155095
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    Fixes bazelbuild/bazel#2709

    RELNOTES: None.
    PiperOrigin-RevId: 155097576
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: bug
Projects
None yet
Development

No branches or pull requests

1 participant