Skip to content

mobile-install: error during mobile install #451

@jagobagascon

Description

@jagobagascon

I'm trying to migrate our Android project to rules_android@v0.7.1, but no matter what I do, I can't run the bazel mobile-install command.

My project is a library that uses JNI and includes an embeded binary file. It also includes an example APP that we use test our library.

Our example APP imports the library as a materialized .aar file.

We do it like this because Bazel changes the name of the generated .so file depending on the name of the rule being built, and we need consistent naming to call System.loadLibrary("our_lib")

android_binary(name = "example_app", deps = [":lib_aar"])
aar_import(name = "lib_aar", aar = ":materialized_lib_with_jni")
aar_with_jni(name = "materialized_lib_with_jni", android_library = ":lib_android")
android_library(name = "lib_android", deps = [":some_cc_dependendency"])

And the aar_import ImportDepsChecker fails with the following error:

ERROR: The dependencies for the following 1 jar(s) are not complete.
      1.bazel-out/darwin_arm64-fastbuild-android-ST-190b1649d98b/bin/example/src/main/_aar/lib_aar/classes_and_libs_merged.jar
The details are listed below:
Missing java.lang.constant.Constable
Indirectly missing class java.lang.constant.Constable. Referenced by:
    java.lang.invoke.MethodHandle
    java.lang.invoke.MethodType
===Total===
missing=1
incomplete=2
missing_members=0

I've tried compiling my code with JDK 11 and JDK 17, and I get the same exact error with both (which is weird because the JDK 11 classes should not depend on java.lang.constant.Constable, introduced in JDK 12).

Maybe this is related to #332?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions