- # As of build tools 24 the dx tool is implemented using java 8, but
- # as dx itself does not support java 8 (class file format 52)
- # we go the .class -> jill -> jack route.
- local DX_JACK=$TERMUX_PKG_TMPDIR/dx.jack
- java -jar $TERMUX_JILL \
- --output=$DX_JACK \
- $ANDROID_HOME/build-tools/${TERMUX_PKG_VERSION}/lib/dx.jar
- java -jar $TERMUX_JACK \
- --output-dex $TERMUX_PKG_TMPDIR \
- --import $DX_JACK
+ # Rewrite packages to avoid using com.android.* classes which may clash with
+ # classes in the Android runtime on devices (see #1801):
+ local JARJAR=$TERMUX_PKG_CACHEDIR/jarjar.jar
+ local RULEFILE=$TERMUX_PKG_TMPDIR/jarjar-rule.txt
+ local REWRITTEN_DX=$TERMUX_PKG_TMPDIR/dx-rewritten.jar
+ termux_download \
+ http://central.maven.org/maven2/com/googlecode/jarjar/jarjar/1.3/jarjar-1.3.jar \
+ $JARJAR \
+ 4225c8ee1bf3079c4b07c76fe03c3e28809a22204db6249c9417efa4f804b3a7
+ echo 'rule com.android.** dx.@1' > $RULEFILE
+ java -jar $JARJAR process $RULEFILE \
+ $ANDROID_HOME/build-tools/${TERMUX_PKG_VERSION}/lib/dx.jar \
+ $REWRITTEN_DX