There are two useful tools which will generate Java code (rough but good enough) from an unknown APK file.
-
Download dex2jar tool from dex2jar.
-
Use the tool to convert the APK file to JAR:
Windows:$ d2j-dex2jar.bat demo.apk dex2jar demo.apk -> ./demo-dex2jar.jar
MacOS / Linux:
$ d2j-dex2jar.sh -f demo.apk -o demo.jar
-
Once the JAR file is generated, use JD-GUI to open the JAR file. You will see the Java files.
The output will be similar to:
Then you can use other tools to retrieve the AndroidManifest.xml and resource files (like images, translations, etc…) from the APK file.
-
$ java -jar apktool.jar -q decode -f demo.apk -o outputDir
-
$ apkinfo demo.apk
-
$ ninjadroid demo.apk --all --extract