ReDex already has a deep integration with BUCK. Steps:
1 - In your android_binary target add the following parameters:
redex = True
,redex_config = <path redex config file>
redex_extra_args = [ <additional args> ]
Example:
android_library(
name = 'test',
srcs = java_files,
deps = test_deps,
)
android_binary(
name = 'test_pre',
manifest = 'AndroidManifest.xml',
keystore = '//keystores:prod',
package_type = 'release',
deps = [':test'],
android_sdk_proguard_config = 'none',
proguard_config = 'test_pre-proguard.pro',
redex = True,
redex_config = 'redex_config.json',
redex_extra_args = [
'-j',
'/android-sdk/platforms/android-28/android.jar'
],
)
Note: Redex will use the commandline.txt
file generated by Proguard in previous step as its proguard-config
file.
2 - In your .buckconfig
file add the redex-binary location in the android section
Example:
[android]
redex=/usr/local/bin/redex