5. Apktool to XX Mobile defender plus advertising page

Source: Internet
Author: User
Tags bulk insert

I. Writing an ad page
write an ad page and call the demo on another page (1) The design interface is as follows

(2) write the code as follows public class splashactivity extends Activity { private static final int Msg_start_menu = 1; /c12> @SuppressLint("Handlerleak") Handler mhandler = new Handler() {Public void handlemessage(android.os. Message msg) { Switch (msg. what) {Case msg_start_menu: Intent Intent = new Intent(); Intent. SetClass (splashactivity. This, homeactivity. class); startactivity(intent); finish();Break ; default:Break ;            }        };    }; @Override protected void onCreate(Bundle savedinstancestate) { Super. onCreate (savedinstancestate); setcontentview(R. Layout. activity_splash); //Set font Typeface fontface = Typeface. Createfromasset (getassets(), "Fonts/handwriting.ttf"); TextView textsplash = (TextView) Findviewbyid(R. ID. textsplash); Textsplash. Settypeface (fontface); //delay Start next activity Mhandler. sendemptymessagedelayed (msg_start_menu, );    }}
Operating Effect:

(3). Determine the modification pointIf you want to insert this splash page into another activity, where do you need to change it? Androidmanifest.xml
Resource copy (picture, font) resource IDControl IDInvoke the activity of the original logic
Remediation in Activity
        class name Package name
        Resource ID
        being called activity
string


two. Decompile your apk 1. Unpacking apkApktool D test.apk

2. Catalogue DescriptionAssets storing font Resources RES storing resources such as Picture resource layout string Smali store code

Other files please refer to the development of the directory, basic one by one corresponding to note that the Res/values directory has a public.xml that the file is generated by Apktool, which saved all the ID options if you need to add a resource ID, directly here to add, Apktool will help you build it back.


three. Start the modification process 1. Unpack the target apk first

2. Adding a stringNavigate to Public.xml to join <public type= "string" name= "Splash_info" id= "0x7f040027"/>


Navigate to String.xml Join

Make sure that the value of the ID and name do not overlap with other strings of string
3. Adding fontsTarget APK does not have assets folder, we can directly copy our assets folder to the root directory.

4. Add a pictureCopy the picture to the Res\drawable folder (note the case with the same name) we do not have duplicate names this time, if you have to take a special first
Modify the Public.xml file <public type= "drawable" name= "Splash" id= "0x7f02001c"/>

You can see that the values and names are not duplicated after the selection.
5. Add LayoutCopy the activity_splash.xml from the layout directory below the target layout
Basically how many control IDs the activity has to define in Public.xml
To make it easy for me to replace all the dimen directly.
Modify Public.xml as follows
<public type= "id" name= "textsplash" id= "0x7f080051"/>

At the same time you need to add public.xmlID of the Activity_splash
<public type= "layout" name= "Activity_splash" id= "0x7f030023"/>

At the same time, you need to add a ids.xml

Record these 2 ID values Textsplash 0x7f080051
activity_splash 0x7f030023
6. Add CodePut test\under the Smali\org\bing\test directorySplashactivity Copy Past Mobilesafe\smali\com\mobilesafe

At this point we find that there is alreadysplashactivity2 Different SolutionsA. Change a directory copyB. renaming
we choose the more troublesome renaming method: (1). renaming source FilesSource file:
Renamed to: (^ _ ^ after adding a 1)

(2). Replace class nameOpen our Splashactivity1.smali.Willorg/bing/test/splashactivity all replacedCom/mobilesafe/splashactivity1

Also in the Splashactivity1$1.smali.will beorg/bing/test/splashactivity all replacedcom/mobilesafe/splashactivity1
Last modifiedhandlemessage inside homeactivity forCom/mobilesafe/splashactivity (main activity of the target app)
(3). Modify the Resource IDFind Setcontentview to modify the above constant value to 0x7f030023
Find Findviewbyid to modify the above constant value to 0x7f080051
Found to be red Smali syntax plugin is cool (please Baidu: Sublime configuration Smali Syntax plug-in with Notepad estimate and be pit a wave)
Red is due to the problem of instruction format, it is good to change const/high16 to const



7. Modify the Androidmanifest file
Change the original main activity to our activity.
8. Back to compile

The error is to review where has not yet achieved a bit
Then sign, run successfully
Four. SummaryBasically what details are needed to develop, and what points to modify here
Practical use can consider the process as an automated process, given an ad template file, automatically inserted in the appropriate location so that you can bulk insert Ads ^ _ ^
Example download link link: http://pan.baidu.com/s/1i5hlCCd Password: pc1c







From for notes (Wiz)

5. Apktool to XX Mobile defender plus advertising page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.