Comments (9)
I've opened #88 to solve the mapping file issue (for classes). I don't have a DexGuard license to test it, if you want you can give it a try.
from ruler.
Should all be compatible now in the latest 1.4.0 release.
from ruler.
Hey, @MrHadiSatrio thanks for reporting this issue!
We will take a look and try to fix this as soon as possible!
from ruler.
Yes, all we should need to do for the mapping files is to figure out if DexGuard (or ProGuard) is used and then use the specific location, something like this:
val mappingFilePath = when {
isUsingDexGuard(variant) -> // Use DexGuard specific path
isUsingProGuard(variant) -> // Use ProGuard specific path
else -> // Use AGP path (like we do now)
}
For the workaround - we could add one by adding a dependency on bundleRelease
, but to be honest I'd rather wait for Guardsquare to fix this issue. In the meantime you can add a workaround yourself by doing something along the lines of in your project:
tasks.named("analyzeReleaseBundle").dependsOn("bundleRelease")
from ruler.
Sure thing @ViktorPetrovski. Thanks for acknowledging the issue!
For what it's worth, I tried adding a dependency to bundleVariant
while the task is being registered in RulerPlugin
to generate the --dry-run
diff below. (Ran on a sample app provided by DexGuard.)
I can also see a difference in the generated reports.
Ruler | Download Size | Install Size |
---|---|---|
1.3.0 |
1.8 MB | 2.0 MB |
Local (post-change) | 623.7 KB | 717.2 KB |
For your convenience, here are zipballs of the reports
directory.
One issue I noticed is that DexGuard mappings are not getting picked up by Ruler. As you can see on the local results, most of the classes are obfuscated still.
from ruler.
Thanks for reporting indeed! That's very interesting, it seems like DexGuard only runs when you explicitly call the bundleRelease
task (or the equivalent for other variants). We use the APIs provided by the Android Gradle plugin to locate and add the task dependencies for the produced bundle file. This doesn't add the dependency on bundleRelease
however, since that by itself doesn't do anything and is only used as a hook for other tasks (tasks like i.e. packageReleaseBundle
that are actually doing the work).
It seems to me like that's an issue within DexGuard, as it should also run without the bundleRelease
task being called explicitly. Other plugins might also rely on the official AGP APIs (as they should) and therefore would also run on the wrong bundle file. Maybe you have a contact at Guardsquare (I'm assuming you're a customer) that you can ask about this? Looks like the task dependencies that they use are not 100% like they should be.
The mapping files not being picked up is another issue - this is on us and we have to implement compatibility for that.
from ruler.
This doesn't add the dependency on bundleRelease however, since that by itself doesn't do anything and is only used as a hook for other tasks (tasks like i.e. packageReleaseBundle that are actually doing the work).
TIL! Interesting then. I was under the assumption that bundleRelease
played a more important role than what you described. I will try to convey this issue to DexGuard. In the meantime, would you consider solving the issue this way as a viable workaround? Or maybe there's another thing that I should look into?
The mapping files not being picked up is another issue - this is on us and we have to implement compatibility for that.
Actually, I've made some progress here too. It looks like the cause is similar. Explicitly setting mappingFile
like so works without requiring any further change.
task.mappingFile.set(File(project.buildDir, "outputs/dexguard/mapping/bundle/${variant.name}/mapping.txt"))
from ruler.
Thanks on the clarification! That is helpful indeed. 👍
but to be honest I'd rather wait for Guardsquare to fix this issue
One downside I see from this is that Ruler would have a soft-dependency on whichever DexGuard version Guardsquare decide to ship this fix in. But yeah, that's nothing a statement on README can't fix.
from ruler.
I also realized that DexGuard obfuscates resource file names by default. And it does so in a way that mess with the directory structure of /res
as well. Unless this obfuscation is reversed, #86 will not be possible.
Excerpt of the generated resourcefilenamemapping.txt
to illustrate:
res/anim/abc_grow_fade_in_from_bottom.xml -> [res/raw/a.xml]
res/anim/abc_popup_enter.xml -> [res/raw/b.xml]
res/anim/abc_popup_exit.xml -> [res/raw/c.xml]
res/anim/abc_shrink_fade_out_from_bottom.xml -> [res/raw/d.xml]
res/anim/abc_tooltip_enter.xml -> [res/raw/e.xml]
res/anim/abc_tooltip_exit.xml -> [res/raw/f.xml]
res/animator-v21/design_appbar_state_list_animator.xml -> [res/raw/g.xml]
res/animator/design_fab_hide_motion_spec.xml -> [res/raw/h.xml]
res/animator/design_fab_show_motion_spec.xml -> [res/raw/i.xml]
res/animator/mtrl_fab_transformation_sheet_collapse_spec.xml -> [res/raw/j.xml]
res/animator/mtrl_fab_transformation_sheet_expand_spec.xml -> [res/raw/k.xml]
We might need to introduce a sanitizer for resource files, just like how one exists for class names. A very rough implementation of it is available here: main...MrHadiSatrio:ruler:dexguard_resource_mapping.
Edit: Getting attribution errors even after de-obfuscating file names. All resource files–including those from libraries–are being treated as if they came from the sample module. 😕
from ruler.
Related Issues (20)
- File/directory does not exist: build/intermediates/runtime_library_classes_jar/debug/classes.jar HOT 3
- Execution failed for IdentityTransform, File/directory does not exist: intermediates/runtime_library_classes_jar/release/classes.jar HOT 5
- Obfuscated native library file names on projects with DexGuard HOT 1
- Gradle 8.0.2 + AGP 7.4.2 Break Plugin HOT 13
- Visualization of data differences between different versions in HTML HOT 1
- Gradle Configuration Cache Support HOT 3
- Accept split apks for CLI HOT 4
- AGP 8.3.0 fails with `NoSuchMethodError` HOT 2
- compare report of different android app bundle HOT 1
- `2.0.0-beta-1` forces consumers to target JDK 17+ HOT 3
- `2.0.0-beta-1` forces consumers to target JDK 17+ HOT 1
- HTML Insights page broken in beta version
- Release Build with DexGuard & Product Flavor Not Mapped in the Report HOT 1
- Please publish to Gradle Plugin Repository HOT 3
- Granular resource file categorization HOT 7
- Discrepancy in install size HOT 3
- Dynamic feature "install-time" not included on report HOT 2
- Size of HTML reports HOT 3
- Support shared ownership of components HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruler.