Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token - on line 11 (while running Redex passing dexguard mapping and config file) #24

Closed
bonnyfone opened this issue Apr 13, 2016 · 3 comments

Comments

@bonnyfone
Copy link

While running Redex on an obfuscated APK (using Dexguard, the paid version of Proguard), the following error appears:

Unexpected token - on line 11
Traceback (most recent call last):
  File "/usr/local/bin/redex", line 779, in <module>
    run_redex(args)
  File "/usr/local/bin/redex", line 735, in run_redex
    dexen)
  File "/usr/local/bin/redex", line 110, in run_pass
    subprocess.check_call(args, shell=True)
  File "/usr/lib/python3.4/subprocess.py", line 561, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'redex-all --apkdir /tmp/tmp63oe7fvl.redex_extracted_apk --outdir /tmp/tmpg3lptjgm.redex_dexen --config /tmp/tmpv5tx4yjm/rewritten.config --proguard-config dexguard-config.txt -Sproguard_map=mapping.txt /tmp/tmpg3lptjgm.redex_dexen/dex0/classes.dex' returned non-zero exit status 1

Here's the Redex config file I'm using:

{
"redex" : {
  "passes" : [
    "ReBindRefsPass",
    "BridgePass",
    "FinalInlinePass",
    "DelSuperPass",
    "SingleImplPass",
    "SimpleInlinePass",
    "StaticReloPass",
    "RemoveEmptyClassesPass",
    "ShortenSrcStringsPass"
  ]
}
}

Invoked with:
redex my.apk -c my.config -m mapping.txt -P dexguard-config.txt -o out.apk

UPDATE:
Line 11 of dexguard-config.txt is the first "good" line of the config file (the previous lines are comments or empty lines) and states:
-dalvik

@rekire
Copy link

rekire commented Apr 13, 2016

I run into a similar bug in my case the problem was my proguard file. So your problem seems to be in line 11 of your dexguard-config.txt. To help Facebook you should add this line to your report.

@bonnyfone
Copy link
Author

Line 11 of dexguard-config.txt is the first "good" line of the config file (the previous lines are comments or empty lines) and states:
-dalvik

@bertmaher
Copy link
Contributor

bertmaher commented Apr 20, 2016

In general I can't support DexGuard configuration files since it's closed-source and not documented as far as I can find. If you're familiar with flex and bison, you can probably modify the parser to get it working and send a PR :-).

But I should note that -P is a work-in-progress feature. It's not actually hooked up to the optimizer, so you won't lose anything by not passing it as an argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants