File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -71,17 +71,18 @@ tmpdir="$(mktemp -d)"
71
71
trap " rm -rf '$tmpdir '" EXIT
72
72
cd " $tmpdir "
73
73
74
- # .apk for apktool and dex2jar to work with.
74
+ # Temporary .apk for apktool and dex2jar to work with, potentially updated with a classes.dex .
75
75
tmpapk=" ${tmpdir} /$( basename " $apk " ) "
76
76
cp -v " $apk " " $tmpapk "
77
77
78
- # Add classes.dex from .vdex, if present.
79
- apkdir=" $( dirname " $apk " ) "
80
- vdex=" $( find " $apkdir " -type f -name ' *.vdex' ) "
81
- if [[ " $vdex " ]]; then
82
- # If there is more than one match from find, the -f will test for "foo.vdex bar.vdex" and fail.
78
+ # Generate classes.dex from .vdex, if necessary.
79
+ if ! zipinfo " $tmpapk " classes.dex > /dev/null 2>&1 ; then
80
+ apkdir=" $( dirname " $apk " ) " # look next to original .apk
81
+ vdex=" $( find " $apkdir " -type f -name ' *.vdex' ) "
82
+ # If there is not exactly one match from find, the -f will test for "foo.vdex bar.vdex" (or "")
83
+ # and fail.
83
84
if [[ ! -f " $vdex " ]]; then
84
- echo " Multiple *.vdex files found in $apkdir , can't continue." >&2
85
+ echo " Not exactly one *.vdex file found in $apkdir and APK has no classes.dex , can't continue." >&2
85
86
exit 1
86
87
fi
87
88
You can’t perform that action at this time.
0 commit comments