-
Notifications
You must be signed in to change notification settings - Fork 46
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
mobile-install fails with dependencies from rules_jvm_external #232
Comments
As far as I understood by looking over the implementation, mobile-install mainly uses the AndroidIdeInfo provider which has a merged R.java: In the extract function from mobile-install/adapters/android_binary:
I am not really familiar with android but maybe this is helpful, as in the stacktrace the error is that the specific androidx/startup/R$string could not be found. When looking at all the split apks that mobile install produces and extracting the dex files there is also only com/example/basicapp/R.class with all the merged resources. |
Okay there are actually two reasons why it fails: In mobile_install/adapters/android_binary.bzl all the resources files are filtered:
Commenting that filtering out makes another problem apparent: The rules_jvm_external ruleset uses jvm_import instead of java_import for importing jar files. I have not yet looked into the difference but changing that to java_import leads to everything working with mobile-install. What is the reason all resources files are filtered out? Is it important or was it just overlooked that it filters out external resources. Should they be added somewhere else? |
The reason why jvm_import does not work is that it has to be added to the adapters in the mobile-install aspects. |
So the problem was threefold:
Let me know if this makes sense and whether these proposed fixes are appropriate, so that I can open a pr. |
Hi, thanks for filing this issue!
|
rules_jvm_external is not setting the package field in aar_import and as the BUILD file with all imports is in the root of the generated repository the package name is empty. My usecase was just importing any library from maven but because the package name is unset the resources are missing or in the wrong location for them to be found. The patch I shared was before I found out the problems, it was just importing packages from maven via rules_jvm_external where the problem happened. I can clean up a bit and make a pr so it can be looked at. |
This commit should resolve that issue. |
When trying to use mobile-install on the example/basicapp I am getting the following stacktrace after launching the application: stacktrace.txt
I am using rules_jvm_external with an overridden rules_android to the version from rules_android git repository.
This is a patch to apply to the example:
Edit: I forgot to mention that building and manually installing the apk works fine.
The text was updated successfully, but these errors were encountered: