Build apk in c# application? - android

So im making a C# application which I want to be like a small configuration GUI where the user can input his own parameters and select some features, and according to those a xml file will be made and put in a prebuilt ready-to-build android project (in the asset folder). Now i'm struggling with the part where the C# application should compile the project and make a final apk. I tried to use ant but fail hard at understanding how to use it. Any help would be appreciated, but please be detailed im new to this kind of stuff.

This is a rather old question, but I'm going to answer it with my final solution.
I created a builder in C# by including the free apktool (and required files) in my project, which could decompile and compile an apk.
So what I did was after making my app, decompile it with apk tool, and then include the decompiled project with my c# project. The user generated a config file using the C# application, and it was deployed in the /assets/ folder of my app since my app expected it to be there.
Then I builded it again with apktool and signed using a debug keystore. (debug keystore is default if the user has no idea what that is, another keystore can be selected)
Keep in mind that, for this to work, the end user has to have java SE installed, I listed these 2 as "required" in my application (PC restart after installation recommended):
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
Hope this helps anyone finding this, rather old, post!

Related

How to extract source code from installed app?

I was developing an Android app for more than a month, but my computer crashed and I lost all the code from it. I have a compiled app installed on a test phone and tablet. Is there any way to extract source code from it?
I followed some guide for game modders (they are probably doing something similar), and I have extracted .apk with an app called Total Commander. Now the guide states that I should extract it with the apktool. But all files are still in binary (when I opened them I got random chars). Now, is there any tool (for Linux) that can decompile .apk back to source code, or maybe some feature of apktool I miss?
Note: I also tried this answer from 10 but also without success.
EDIT: javadecompileonline also did not decompile binaries correctly,
so this should be .json file:
<m*/��%kي%jTƴ���69/�t��
č �Cx���Q�đš?������i�
ć���/��i�JRᙱg�.�s
First you go to Android studio's welcome page there is a option to extract source code from APKs.
Another way is to install this apk extractor application from play store then you can extract source code from APKs Link : https://play.google.com/store/apps/details?id=com.ext.ui

Can I convert Apk file back to android studio project?

I made my android project and run the app on my phone. I got the apk file and also app but accidentally deleted app. Can anyone Help me out please.
If your apk not obfuscated by proguard or other third party also not build by signed. Probably you can use an software like Dex2Jar. But i am not really sure about this, you can try it. There are tutorial here
Reverse engineering your app is theoretically possible but hard.
1) Use the Apktool which would help generate a little code and the resource files.
2) Use the jadx tool which helps to produce Java source code from Android Dex and Apk files.
Next is to open a new Android Studio project, copy the manifest file generated by the Apktool into the manifest of the new project, Copy the resource files generated by Apktool to the res section of your new project, Copy the java files generated by jadx and place them in the src folder of your new project.
Try to build the app but you'll definitely run into several errors. Try following the messages to fix them.
Reverse engineering your app is very tedious and you still might not be able to build the app.
Goodluck :)
Added 24th November 2019
Just found this awesome article on how to go about Reverse Engineering an Apk.

App Recovery - Decompiling Android Project Classes From APK

I am currently working on an android app but my hard drive unfortunately crashed and I lost all the data on it... I am trying to recover my source code from the debug APK I had installed on my phone (using dex2jar and jd-gui) however, it seems like the classes are not present in the classes.dex and classes2.dex (both files are tiny and do not contain any of the classes in my code, see photo).
I used apk extractor to get the apk from my installed app and I cant seem to get anything close to my original classes... I am wondering if I am doing something wrong to get the APK from the installed app; any help would be greatly appreciated.
Thanks.
For de-compiling your APK to Java classes you can go to this site -
http://www.javadecompilers.com/apk
Just upload your apk and click on decompile. It should work for you !

Android Apk to Pure Java files

I have developed an Android app in Android studio and have uploaded its apk in Google Play Store as well. But I had lost all the files(java+xml) of the app.
Now I only have the apk from play store and also the apk before uploading to Google Play Store (apk before performing encryption).
Now I want to get all the java files and xmls of the app for updating the app. I have tried all the steps mentioned by previous StackOverflow questions but I was not able to get the Java files properly. I was able to get the xmls properly. Java files I got was somewhat not understandable format (partially compiled/transformed)
So my question here is can I get all java files as normal java files without any compilation/transformation?
Please help guys. Thanks a ton in advance
Nope, you can't. Unless going through reverse engineering process, something like dex2jar...
The first step is to extract your APK archive and copy the file named classes.dex to some other directory. Next you need to convert your dex file into jar format.
For that you can use this library. Bear in mind that you have to build it first using gradle.
The final step is to decompile your java class files into proper java files. Use this tool.
Voila, you have your source code. That is if you haven't used Proguard to obfuscate your code.

Export apk from phone?

I compiled and ran a project on my phone through eclipse which is still install there currently. While doing some directory cleaning I accidentally deleted the source code so the only remaining version of the code is in the apk installed on my phone. Is there anyway to export the app back to my computer?? It isn't signed or anything either.
Thanks!
You can set up to be able to copy files on/off your phone via the USB connection - heres where you can look to find it:
Does Android keep the .apk files? if so where?
Then after you get the .apk off look at these questions for decompiling:
Is it possible to decompile an Android .apk file?
decompiling DEX into Java sourcecode
You CAN pull the APK off of the phone, but it's going to be Java Bytecode, not your source code (regardless of whether or not it's signed). You would have to reverse-engineer the classes to retrieve your code. If it's not a VERY large app, I'd say your time would best be spent simply re-creating it.

Categories

Resources