Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
174 views
in Technique[技术] by (71.8m points)

java - How to obfuscate Admob Unit IDs in String?

I want to hide my Admob unit ids. I use proguard but the strings file is not hidden. I can solve this with a simple program and see its content. What can I do about it?

<string name="banner_top">ca-app-pub-3940256099942544/6300978111</string>
<string name="banner_bottom">ca-app-pub-3940256099942544/6300978111</string>

My code:

<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/top_banner"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_gravity="bottom|center"
    android:layout_marginTop="4dp"
    android:background="@color/white"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_top" />
question from:https://stackoverflow.com/questions/65898296/how-to-obfuscate-admob-unit-ids-in-string

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is an Obfuscapk tool. It has different obfuscation options. For your specific case ResStringEncryption should be fine. You have to use strings in your source code to use this option. (even if you don't need to, just make a dummy use of those strings)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...