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

Ruler error when using Restring in dynamic feature #153

Open
0xffrom opened this issue Sep 8, 2024 · 3 comments
Open

Ruler error when using Restring in dynamic feature #153

0xffrom opened this issue Sep 8, 2024 · 3 comments

Comments

@0xffrom
Copy link

0xffrom commented Sep 8, 2024

Hi! I am using Ruler to measure the size of an app through App Bundle analysis.

I will add a dynamic feature that depends transitively on Restring.

When trying to do aab analysis via Ruler on a release buildtype of an app using shrinker, I get an error

* What went wrong:
Execution failed for task ':app:analyzeReleaseBundle'.
> Resource table of module 'dynamic' contains references to non-existing files: [res/layout/test_layout.xml, res/menu/test_menu.xml]

Can you add these resources to the test sourceset?

I'm using workaround to keep shrinker from deleting these resources, but I still don't like them going into the release build.

@Keep
class RulerWorkaround {

  val testMenu
    get() = dev.b3nedikt.restring.R.menu.test_menu

  val testLayout
    get() = dev.b3nedikt.restring.R.layout.test_layout
}
@0xffrom 0xffrom changed the title Ruler error when using and Restring in dynamic feature Ruler error when using Restring in dynamic feature Sep 8, 2024
@B3nedikt
Copy link
Owner

B3nedikt commented Sep 8, 2024

What is Ruler?
Also on the stackoverflow answer you linked someone wrote the solution does not work anymore in newer IDE versions. I guess the simplest solution would be to move the tests including the test only resources to a different module.

If you think a different solution makes sense though, feel free to create a PR :)

@0xffrom
Copy link
Author

0xffrom commented Sep 9, 2024

Ruler is a library for measuring app bundle size

But it reproduces it without a Ruler too, using ./gradlew app:packageReleaseUniversalApk, this command creates an apk based on the app bundle

If you think a different solution makes sense though, feel free to create a PR :)

Ok, thank you)

@B3nedikt
Copy link
Owner

Cool plugin, I saw it already before, but completely forgot about it ;)

I think I will implement the solution of just moving all test code into a new module, should be quick to do. I will release it in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants