How can we find and fix obfuscation errors? (App works when obfuscation not selected).

63 views
Skip to first unread message

davefinney

unread,
Oct 30, 2018, 5:51:52 PM10/30/18
to DroidScript
With DS v1.68, app has "obfuscation errors" when creating an APK. These start with "Unexpected token punc, expected punc (line:418, col: 41, pos:15858)".

The line (418) doesn't seem to refer to the DS line as all that's there is setting up an object (which seems ok).

What advice is there to find and fix these obfuscation errors?

Steve Garman

unread,
Oct 30, 2018, 6:16:01 PM10/30/18
to DroidScript
That error is usually caused by trailing commas in your code such as

app.CreateText("Hello", -1, )

The obfuscator is confused by expecting another argument that is not there.

Just remove the final comma.

davefinney

unread,
Oct 30, 2018, 6:59:52 PM10/30/18
to DroidScript
Hi Steve,
I can't find any trailing commas. The line at 418 is:

User[f] = { Name, DoB, Loc, Units, No: f };

Problem seems to be something to do with creating Objects.

Steve Garman

unread,
Oct 30, 2018, 7:29:51 PM10/30/18
to DroidScript
That line, when taken in isolation, doesn't make any sense.

The compiler can deal with it because it has access to the value of Name, DoB etc. but if you want to obfuscate the code you will need to write the code more consistently, such as;

User = { "Name":Name, "DoB":DoB, "Loc":Loc, "Units":Units, "No": f };

davefinney

unread,
Oct 30, 2018, 7:40:26 PM10/30/18
to DroidScript
Hi Steve,
Yes, the App has User= []; before and each value has been defined.

I'll try expanding as you suggest. Thanks for the suggestion.

davefinney

unread,
Oct 30, 2018, 8:01:07 PM10/30/18
to DroidScript
Excellent, that's fixed it!

This seems to work: User[f] = { Name: Name, DoB: DoB, Loc: Loc, Units: Units, No: f };

It seems the compiler can't handle the shorthand for Objects.

Thanks Steve.
Reply all
Reply to author
Forward
0 new messages