0

My friend and I are building an android app for an FBLA State Leadership Conference Competition.

We used MockingBot to create a "blueprint" for our app, and planned on using Android Studio to replicate the design & make the app functional.

We downloaded the Android APK file from MockingBot. Instead of re-making it on Android Studio, is there a way that we can extract the Java & XML Files from the APK, and put them into Android Studio to complete most of the XML work, then tweak it from there?

THANKS

Youcef LAIDANI
  • 55,661
  • 15
  • 90
  • 140
Ethan Reinsch
  • 137
  • 1
  • 10
  • 3
    See http://stackoverflow.com/questions/3593420/is-there-a-way-to-get-the-source-code-from-an-apk-file – Alex Dec 30 '16 at 20:27
  • This is called decompiling, not converting. You may use `apktool` to extract resources, `dex2jar` and a `java decompiler` to decompile jar. Though decompiler does not always work for all sources, and obfuscated code will be messed up for reading. – Yaroslav Mytkalyk Dec 30 '16 at 20:27
  • In the future, if you want to do this, use some mocking tool that is designed with a code generator, with the intention that you be able to use those generated items. Whatever you reverse-engineer is unlikely to be easy to comprehend. – CommonsWare Dec 30 '16 at 20:34
  • Have you tried this awesome tool called Google Search? – Ali Bdeir Dec 30 '16 at 20:46

1 Answers1

2

You'd normally be able to do something like this with a number of tools. apktool and dex2jar are good, jadx is a great all in one solution too. In this case, it looks like MockingBot uses Cordova to generate your app, meaning there is almost no real Java/Android code to decompile. It is essentially a web wrapper so you can build cross platform apps.

jadx will still allow you to extract everything from the application, but it might not be easy to reconstruct. I would suggest checking out Apache Cordova, or another project that implements it, such as Ionic if you intend on going this route. If you do, I also suggest using an IDE better for web developing. You can still use Android Studio, but vanilla Intellij might make your life a little easier.

Assuming MockingBot didn't use any Cordova plugins, you can simply unzip the APK and use what falls under the assets/www directory to start customizing your app using Cordova.

Edit: Because I can't comment without at least 50 points... This actually isn't a duplicate as was already suggested. The question might seem similar, but web wrapped applications are very different from those built using Java and much easier to decompile/reverse. The answer linked in your comments will very likely not help you.

Dan 0
  • 914
  • 7
  • 15
  • Dan, thank you for the reply, but I don't really understand all of what you're trying to tell me. I'm pretty new to java & app development. So, can or can't I get the Java & XML from the Android APK file? If I do get it, can't I just copy and paste it into Android Studio? What is the difference between Android Studio and Intellij? What does Apache Cordova do - Allows me to build apps using HTML, CSS, and JS? How do I unzip the APK (Is it the same as extracting with winRAR)? Sorry I'm a NOOB. Thanks!! – Ethan Reinsch Dec 30 '16 at 22:25
  • You can get the Java and XML, but it won't do you any good. MockingBot is using a framework (Cordova) that rather than using the standard platform language (Java in the case of Android), it constructs a web app, optionally with hooks to use platform specific functionality. In Android at least, Cordova uses the WebView to display your app. Don't think of this as an Android application, it is a web app with Javascript, CSS, and HTML. The assets/www directory is where the web app is stored. – Dan 0 Dec 31 '16 at 17:40
  • If you wanted to edit this app, you would have to read up on Cordova and see how it is used so you can copy the application into a new project and edit it how you wanted. You can unzip the APK with any standard unzip utility. An APK is almost no different from a ZIP file. If you're on windows, you can just change the extension name so the OS can recognize it as an archive, on Linux you can simply `unzip [file name].apk`. Android Studio will restrict you here because it is only designed for Android apps, you're modifying a web app. Intellij is very simliar to Android Studio but more extensible. – Dan 0 Dec 31 '16 at 17:47