How to Decompile, Modify APK and Recompile using Apktool 2024

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi this is smart Dev coder in this video I'm going to show you how to decompile an APK file edit it and modify the code and recompile the code to APK file and sign it then install it okay nobody in the whole YouTube had explained this topic like this before so B so please uh watch till end of the video to get the knowledge regarding this and let me know your opinion of my explanation in the comment section okay without any delay we'll just proceed to the video so first what we have to do is we need to know the requirements for this okay [Music] so requirements for this is you need to have a text edor like notepad++ an APK tool which you can get in the Google then if you have a basic knowledge in Android development that will be very good if not also no problem we will I will explain in such a way that any one can do it okay you need to have some interest to learn then an Android Studio software is needed but it's not mandatory I'm using this to show you how the app is developed with the original code I will make the that code to APK file and I will decompile it so what I'm doing is I am generating APK myself and decompiling it editing at recompiling the whole thing is done on my own app so please don't use this to this method for any bad uses this is just for educational purpose only okay now we will move to the main part of the video that is decompiling compiling and editing okay first now we are on Android Studio project which name is healths okay this app name is Health FS I just made named it like that okay and it's having just a one main activity file okay uh which opens this [Music] one okay and one more thing is I also we'll be using chat GPT for this for making the process little bit faster okay so here this is a text view so for making it some live app look like Live app I going to ask chat gbt to make me a layout XML layout of a login screen okay give me an andro XML layout of sign [Music] in fields [Music] with some colorful decorations press enter so now the chat jpd will give us some code so why I'm using chat jpt so for typing all this code it will take a lot of time so I'm just copying this one and moving to Android Studio I'm replacing everything with that code okay now we got our layout but we have some errors because these fields are not in my okay let's fix it let's copy this code and replace with entire code so now we have got some uh username and password and login button so but this is not a functional thing just it's any way okay so we will make it to come in the the center so gravity Center vertical so we'll go to gravity instead of layout gravity okay now the entire thing has to came to center now what I want to remove in this code is first I want to add a code in this uh that is if developer options are enabled in your device this app will detect and show the dialog to disable the developer options so what I will do is I will remove this part of The Code by decompiling the APK so first we will go to the chat jpd again open the new chat and ask chat GPT to give me code give me Android Java code for detecting detecting developer [Music] options in Android developer options enabled and show dialogue to user to Des aable developer options and the dialogue should be set [Music] cancellable to false let's see what it will [Music] give okay so now what is telling is it is telling us to create a class here okay like this developer options Checker its class name is developer options Checker now I'm copying this name of the class and I create a new Java class here with the same name okay uh now I will copy this code entire [Music] code and paste it here okay so uh everything is good there is [Music] no errors here okay now I will ask the chart GPT how to call this method [Music] okay so we need to copy this one just this four lines and we have to go to the activity where we want to check it so I want to see here so I will paste this one [Music] here okay uh now let's go to developer options Checker and let's see it is highlighted or not okay we are going to the class here next thing is we will once check this code and what it it is explaining explain okay [Music] so here in this show developer options dialog it is showing showing a dialogue with the title developer options enabled please disable options to continue this is a message and we have two buttons positive button and negative button positive button will have open settings so that we go there and disable the developer options and negative button is exit okay we just asked chat gbd to show the dialog uh to disable the developer options but it also gave us uh one more option that is we to go to the settings directly from the dialog by CLI on a button okay now what we will do is now we call the method there now we will move this text to strings.xml for that what we will do is we will copy this text here we go to values strings.xml so uh dialog we'll get dialog name and this will be the string next we'll make the another string dialog message and for this we will copy this one this is a correct way of uh sorry not here here okay now we will call these things into the dialog check options Checker [Music] class R do string dot dialog name next the message R do string dot dialog message okay so everything is okay now what we will do is uh I will connect my device [Music] here I'm connecting my mobile device Android device here so that you can see my Mobile screen okay it's connected just open it okay now you can see this uh realme rmx 31521 because this Android Studio has detected my device now what I will do is I will run the app and we will see what will happen first what we will do is we will comment out this code and we will run it empty okay okay now our app is going to launch in my device you can see at the bottom here launching on device okay now you can see the app is successfully launched and we are on the login screen which says username password just login but nothing will happen here because it's just a dummy screen now what I want I want is I want to show the dialogue if developer options is enabled so now we will relaunch the app after uncommenting the lines that shows the [Music] dialogue okay app is uh relaunching now so now I have made some changes uh instead of uh adding separate class for developer options Checker what I did is I made it to appear as a methods in the same class and I called it here okay now let's see we will run the app and see what will happen [Music] so now we can see developer options is enabled please disable developer options to continue so if I press back also the dialogue will not close because here it is already mentioned that set canable to fall so we cannot close it okay so if I click select and open settings it go to developer options and I can disable the developer options here okay so uh one small glitch is there I have to finish the app after the opening the setting so I'm adding this also because what happened here is after clicking on the dialog dialog has closed and on the app it is now we are able to access the login screen so it should not happen so this is the thing so now now what I want to is I want to uh remove this dialogue by decompiling the app so for that first we need an APK so now I will build the APK I'm not going to explain how to make the keys everything like this because that is not necessary in this video I may make a video regarding these things in the future so let's click on next then click on Create and we will wait for a couple of minutes for the APK to [Music] generate okay our APK successfully generated here you can see generate signed APK build completely completed successfully for the health F fors so we will locate the APK file and the APK file will be under the release folder we will copy this one and and I will go to my APK tool [Music] file okay APK tool file and I will paste it here somewhere or we can do one more thing we can just uh Delete here and we will rename this a app. rel. apk2 healthcore FS this is my app name okay now what I will do we will click here and copy the address to the path here now I will open the APK tool okay now in APK tool I will click on browse button and I will paste the address and press Center so this is our APK file double click it it will come here just click on decompile and you can see the message here de compiling APK file uh we need to wait until it shows us completed okay now we can see a message here decompile successful for that we need to go after that we need to go to decompiled apks here if you can't find this folder where it is you just click on decompiled APK directory here okay uh so our code has been decompiled like this here so what we we want to do is uh first we need to know the package name of the APK file for that what you have to do is you just keep exit and from Play Store install an app called APK extractor APK [Music] [Music] extractor and search for our health FS okay this is our app and you need to know the package name here so you can see it is showing what is the package name com. aam r r i Ms okay this is the package name of our health Forest so what we will do is we'll go to the SMY folder here inside SMY so we go to com so after the Tom com it is aom after that it is R Ms so open it so you can see here are the all the Java classes of our app belongs to okay and what we have to do is we have to copy this path then we need to go back to the main folder then open the RS then open values folder okay inside that go to the strings.xml file right click on it so if you install the notepad++ you will get an option like this edit with notepad++ just open it so now we got all the strings available in that file [Music] okay so now what we have to do is we have to press control shift F here and in the directory we have to paste the path we copied okay now what we have to do is in the app what we are getting so let's uh run the app again or you can run from here only so what we got here if you run the app we are getting a dialogue we cannot exit we cannot close it by the back back button if we click on exit or open settings the app will close but the dialog will not go so what we have to do is we have to uh search for this these things so here what we have developer options enabled so go to Strings first click on the find here type developer options click on find next so here so here we got please disable developer options to continue and here is a title developer options enabled so this is what we are seeing on our screen so you just click on this dialogue what is whatever the string name is then after selecting that press control shift on your keyboard and remember uh we have pasted the path to directory where it have to search Okay now click on the find all button so it got we got our results it is in two places dialog name and dialog name here so Main activity and string do small we got the here also dialog name okay this one okay uh so these are this is the code and this is the show dialogue developer options enabled okay method so this is our main class on create method is there and inside it show dialogue is enabled is here okay so what we have to is we have to remove these two lines we need to remove these two lines so this is the line which is checking whether the developer options is enabled and opening the dialogue so what we is we need we need to remove these two lines once we'll go to the Android Studio code okay this one this is a method this is a method and this is the line we are calling and you can see the text here show dialogue if developer options enabled here you can see same thing show dialogue if developer options is enabled okay mostly in this in this app we are getting uh from this but uh usually we have to navigate to that place by finding this one okay but in this app it is decompiled like this which is directly giving the location with the name okay so this is a main activity do class which is the main class of our app and this is the [Music] line and this is the line which is calling these two methods so what I do is we [Music] will we will remove these two lines here and we will save it okay now again go to the APK tool click on compile and it is showing the message compiling APK file we need to wait until it is shows signed successfully okay you can see sign successful Mage has came uh now we need to install this one but before installing what we have to do is we need to uh uninstall the existing app from our mobile because this app is signed with a different key and we which we signed after decompiling will be the different key so this will not install for example I will show you even by trying to install it so what we have to do is after successful compilation we need to click on the compiled APK directory so we got here now we'll press uh type CMD and enter we'll open the command prompt so shortcut to install the APK via ADB to your Android device or ulatory just type ADB install r space and the app name the forest. APK and press enter and we will get the error message here now you can see f fail to install Health Forest APK uh install failed update incompatible see sign signatures you can see signatures do not match newer version ignoring okay so what we have do we have to uninstall this [Music] one and we will install [Music] again [Music] so now now we got success message here now we will open it it and search for health Forest here okay now I open it now you can see there is no dialogue even my developer options are enabled even I will show you my developer options okay you can see my developer options are still enabled even though the dialog has disappeared because we removed the part of the code which is showing the dialogue okay so this is how we can edit see editing an APK file by decompiling it and finding the code where we have to edit is a very tough process it is time-taking and most uh experience is needed for that I have almost 7 to 8 years of experience uh in decompiling and actually I'm an Android developer I'm also I do the reverse engineering off in Android APK I have 7 to 8 years of experience in this if you want to mod anything in any any of your apps I'm telling your apps which you may lost the source code of it I can assist you but these services are chargeable if you are interested please DM me or just comment your email in the comment box I will reply you thank you thank you for watching and if you find my video is helpful please share this with your friends and click on a like button so that it it will encourage me to more to do videos like this thank you this is smart Dev coder signing off
Info
Channel: The Smart Dev Koder
Views: 2,336
Rating: undefined out of 5
Keywords: APK decompile, APK modify, APK recompile, Apktool tutorial, Android app hacking, Reverse engineering Android apps, APK hacking, APK modding, Android development, Mobile app customization, smart_dev_koder, edit smali code, Smart Dev Koder, latest 2024, apktool latest 2024, recompiling errors, apk not recompiling
Id: MwJ2xZB5QWg
Channel Id: undefined
Length: 27min 49sec (1669 seconds)
Published: Sun Mar 31 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.