Fixed
Status Update
Comments
ja...@google.com <ja...@google.com> #2
This won't make 3.6 but I'll do it for AGP 4.0
dr...@gmail.com <dr...@gmail.com> #3
Great and thanks! Looking forward to it.
dr...@gmail.com <dr...@gmail.com> #4
There is a typo in my original post:
> ...and obviously they won't be changed to be removed when ProGurad...
should be →
> ...and obviously they won't be changed or be removed when ProGurad...
> ...and obviously they won't be changed to be removed when ProGurad...
should be →
> ...and obviously they won't be changed or be removed when ProGurad...
ja...@google.com <ja...@google.com> #5
It's worth noting that making this change does not actually prevent leaking the name. The names are present in the resources.arsc file (which is where getResourceEntryName resolves the ID-->name mapping which neither ProGuard nor R8 will obfuscate.
That being said, I'll still probably make the change.
That being said, I'll still probably make the change.
dr...@gmail.com <dr...@gmail.com> #6
That is right to R8/ProGuard, but there are some tools that can obfuscate the resources, such as:
* AndResGuard - proguard resource for Android by wechat team:https://github.com/shwenzhang/AndResGuard
* AAPT2 --enable-resource-obfuscation: `aapt2 optimize --enable-resource-obfuscation --enable-resource-path-shortening`
* AndResGuard - proguard resource for Android by wechat team:
* AAPT2 --enable-resource-obfuscation: `aapt2 optimize --enable-resource-obfuscation --enable-resource-path-shortening`
ja...@google.com <ja...@google.com> #7
Integrating aapt2 optimize into the Android Gradle plugin pipeline is actually my next endeavor!
dr...@gmail.com <dr...@gmail.com> #9
Nice! Thank you very much!
Description
Gradle version: gradle-6.0-rc-1
Android Plugin Version: com.android.tools.build:gradle:3.6.0-beta01
Module Compile Sdk Version: 29
Module Build Tools Version: 29.0.0 (or default)
Android SDK Tools version: 29.0.2
Below this is the code generated by View Binding. It contains a lot of hard-coded id names Strings, and obviously they won't be changed to be removed when ProGurad is done, so this can lead to exposing our code naming. So, can you not generate an ID name for Release?
Or, try the API: String missingId = rootView.getResources().getResourceEntryName(R.id.xxx);
@NonNull
public static ActivityMainBinding bind(@NonNull View rootView) {
// The body of this method is generated in a way you would not otherwise write.
// This is done to optimize the compiled bytecode for size and performance.
String missingId;
missingId: {
FloatingActionButton fab = rootView.findViewById(R.id.fab);
if (fab == null) {
missingId = "fab";
break missingId;
}
RecyclerView list = rootView.findViewById(R.id.list);
if (list == null) {
missingId = "list";
break missingId;
}
CoordinatorLayout root = rootView.findViewById(R.id.root);
if (root == null) {
missingId = "root";
break missingId;
}
Toolbar toolbar = rootView.findViewById(R.id.toolbar);
if (toolbar == null) {
missingId = "toolbar";
break missingId;
}
return new ActivityMainBinding((CoordinatorLayout) rootView, fab, list, root, toolbar);
}
throw new NullPointerException("Missing required view with ID: ".concat(missingId));
}
Thanks!