‫Instructor: Hi.
‫Within this lecture we are going to see the usage
‫of a tool called ProGuard.
‫So this is a tool that enables developers to obfuscate
‫or encrypt their code so that when a hacker
‫or a security researcher decompiles it,
‫they won't see the source code directly
‫but they can see it in a concealed way.
‫So let me show you what I mean.
‫Open your My Reverse app one more time
‫and go under this Gradle scripts,
‫we have looked into this build.gradle app file before.
‫So we have this general settings like compiled version,
‫minimum SDK version,
‫but also we have this minify enabled
‫thing in the middle of the build.gradle file.
‫Right, we haven't seen it yet.
‫So this minify enabled actually is for ProGuard usage.
‫ProGuard doesn't only encrypt the code
‫but also shrinks it
‫in a way that it actually makes
‫the APK
‫in an efficient, smaller way.
‫Like, it removes the unnecessary code
‫and your final product, your final APK,
‫would be in a smaller size.
‫So I see many developers forgetting about this
‫or ignoring this at all,
‫but actually it's a very good idea
‫to use this pro tool in order to protect your code
‫and also in order to make your APKs in a more efficient way.
‫So in big projects, in big apps, most of the time
‫you will see this minify enabled as true or
‫they would be using some other tools as well.
‫But ProGuard is the choice of Android Studio
‫and it's doing a good job for this.
‫So if you change this to true,
‫then it will be enabled in your code.
‫So once you create a new APK,
‫obfuscation will be enabled,
‫and your code will not be decrypted as easy as it was.
‫So we are going to experience that as well.
‫So make sure you make this true, okay?
‫And then you have to sync everything
‫so that your project will be synchronized across your app.
‫And also, right now, we are going to see how to create
‫signed APKs with inside of Android studio.
‫So before we do that
‫I'm going to make this available for debug as well.
‫So I'm going to copy this release
‫with the curly braces as well.
‫Okay?
‫And paste it just below the release section
‫and name it debug.
‫So it will create two APKs,
‫one for release and one for debug.
‫Generally, we use this release thing for Google Play
‫and debug thing for debugging the application.
‫And I want the ProGuard to be enabled for both of them.
‫So I want to do this as release and as debug as well.
‫So make sure you do it.
‫And then after you sync,
‫you can come over here to build section,
‫and remember we build APKs like this before,
‫but now, we are gonna use this option to generate
‫signed APKs with inside of and Android studio,
‫just to know, just to understand how it's done as well.
‫And you can build the APKs, and manually sign it,
‫and it will produce the same result.
‫But this is a good skill to know.
‫This is a good idea to implement,
‫and we are going to see how it's done.
‫Remember we should check the APK option and hit next.
‫And after that it will ask for a key store path.
‫So we don't have the key store file, we deleted it.
‫Remember it was our own desktop, and then we deleted it,
‫and then now we're going to create it from scratch.
‫And we can do it by the same command with terminal.
‫Okay, I'm going to delete everything from here as well,
‫by the way.
‫And we can do it same command with inside of terminal.
‫But right now I'm just going to do it inside of
‫Android Studio so that you can understand how it's done.
‫So I'm going to say create new,
‫and I'm going to choose a path for my key.
‫So the path that I'm going to choose is the desktop itself
‫one more time.
‫And you can choose your own path,
‫but you have to give it a name like Key Star, okay?
‫So that's all you need to do.
‫And after that it will add, it will ask a password,
‫and it will edit once you type it,
‫just make sure you type the same password, okay?
‫And over here in the key section, you're more than welcome
‫to use the same password as this one, right, again.
‫Okay, make sure you don't forget it.
‫And in here, you choose a validity.
‫So it's valid for 25 years.
‫Okay?
‫And after 25 years, you can just create a new key store
‫and sign it with the new one.
‫So you can actually give the names and the organization
‫and the country and everything over here.
‫But in this Android Studio case, at least one of the
‫certificate details should be filled in.
‫Okay?
‫So I'm going to give it name like Atil Sam.
‫This should be sufficient enough for us to continue.
‫And if I say okay, as you can see, all the detail is
‫filled in right now and I can say finish.
‫And as you can see,
‫there is a debug or release selection.
‫Make sure you hit the shift on your keyboard
‫and select both of those.
‫And again, in the signature versions
‫make sure you select the V1 and V2.
‫And this is for jar signature and V2 is full APK signature.
‫Just make sure you choose both of them and say finish.
‫So this will generate the APK and sign it as well,
‫so that you won't be dealing with the signing process
‫after all.
‫And this is how developers actually create their APKs
‫and upload those APKs to the Google Play.
‫So now you know how to do this as well.
‫So after you are done
‫it will give you the location of the generated APK,
‫which will be most probably inside of your project folder
‫one more time.
‫So after this is done, just click on the locate button,
‫or you can actually open the project file as well.
‫And I believe we don't have the
‫locate button
‫in this section.
‫I dunno why not.
‫But we can reach it from the project folder.
‫So I'm gonna open my project folder, okay, from here.
‫So we used to go into the app,
‫and we are gonna do the same thing again, okay?
‫There is a build right now.
‫However, this is not the build that we are looking for.
‫We are looking for the build inside of the app itself.
‫So under the build you will see the output APK debug.
‫And this was the debug file that we have created before.
‫Right now we are not interested with this debug file
‫but rather we have this release
‫and debug folders separately under the app folder.
‫Okay?
‫So right now I'm inside of the app,
‫and I can reach the app debug APK that I reached before,
‫the same way that I reached before.
‫But if I go to release,
‫I can see the app release APK, and I can use this APK
‫in order to decompile it with
‫JDX and see
‫how
‫it's
‫done.
‫Here we go, now we see it's smaller in size than before
‫because we used obfuscation.
‫And I'm going to copy this on my desktop.
‫Okay?
‫And I'm going to use JDX to see what we get in return.
‫So over here I'm going to stop,
‫and within the next lecture we are going to decompile it
‫and see how it looks like.