Android Tutorial Code Obfuscation

peacemaker

Expert
Licensed User
Longtime User
Oh, clear, was reading this, but as usual not to the finish :-(.....
 

pwme

Member
Licensed User
Longtime User
Code Module

I put some strings on "Sub Process_Globals" of an code module. Are these variables obfuscated too?

example:
'Code module
Sub Process_Globals
Public full_version_encrypted_value="@frgtfvfaajfr+!"
End Sub

is "full_version_encrypted_value" variable obfuscated?

Thank you in advance
 

socialnetis

Active Member
Licensed User
Longtime User
Does the obfuscation works for the process globals of a code module? I want to put some app-ids in there and make sure that they will be safe
 

kiki78

Active Member
Licensed User
Longtime User
Hi Erel,

I try to use obfuscation, but i'm disappointed when I examine generated Java code.
All code line are precede by comment line with clear code : //BA.debugLineNum = xx;BA.debugLine="Clear code"
So where is interest of obfuscation ?
Does I miss some B4A parameters to remove that ?

Regards,
 

kiki78

Active Member
Licensed User
Longtime User
Thank you Erel
One more time I write to quickly.
I make mistake and I thought that src directory was included inside apk.
Sorry for inconvenience
 

ArminKH

Well-Known Member
Exactly what is the static string?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
If you write CallSub(Me, "SomeSub") then the compiler knows that that you are calling a sub named SomeSub. The compiler will not obfuscate the target sub name and everything will work.

However if you write:
B4X:
Dim x As String = "SomeSub")
CallSub(Me, x)
The compiler doesn't know that you are calling SomeSub in this code and it will obfuscate the sub name thus breaking your program.
 

ArminKH

Well-Known Member
In dim x as string="subname"
The x is none static string?
My problem is the difference between static and none static strings
 

ArminKH

Well-Known Member
This is only relevant for CallSub and CallSubDelayed calls.

In the case of CallSub(Me, x) the target sub is "dynamic".

You can add an underscore to the target subs to prevent the obfuscator from modifying the subs names.
We can use for example

Sub subname
'------------
End sub

in callsub (if use obfuscate release mode)?
 
Last edited:

vvg

Member
Licensed User
Longtime User
Sir,
This is working excellent. Thank you very much.
I can understand that reverse engineering is always possible but we can make it harder....and same thing you have provided with obfuscator....
But i have a doubt and just for knowledge purpose i am asking this to you....
You have provided obfuscator map file...
If there is other b4a developer and if he tried to know my sourcecode or wanted to decompile my app, will it be easier for him to findout variable name refering obfuscator.map file in his b4a projects??
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
If there is other b4a developer and if he tried to know my sourcecode or wanted to decompile my app, will it be easier for him to findout variable name refering obfuscator.map file in his b4a projects??
You shouldn't distribute the map together with your app. Other developers will not have access to this map.
 

vvg

Member
Licensed User
Longtime User
You shouldn't distribute the map together with your app. Other developers will not have access to this map.
No...obviously i wont let leave my obfuscator.map file with my app.
But he (other b4a developer (cum my app's ..may be.. hacker ) will be having his map file...so i just want to make it clear that is it that easy to guess the name of variables comparing decompiled main.java file to the one or more map file (or files) he is having with him???
I know you must have made it hard...but just asking you to clear my doubt...
Sorry for my ignorance...
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…