This question already has answers here:
Is there a way to get the source code from an APK file?
(32 answers)
Closed 6 years ago.
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
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.
Related
Whats up! I just want to ask, but how do I run an .apk file j2me. I know that this question HAS been asked, but I can't seem to find an answer. Also, i'm not asking to run j2me apps on android; there are already tons of emulators. Im asking for apks running on j2me. I also know that they are developed in different VMs. So, is there any way to do that? Also, another side note, how do i resize the screen of an apk file? Thanks!
-Apersonwithalaptop22
(Edited to be easier to be understood)
You don't. A J2ME environment wouldn't have the Android framework. You'd need to write a complete android framework in the j2me language. It's not as simple as just converting dalvik bytecode to jvm bytecode- it's actually providing every single android class in the SDK. It could be done, but it would take one person a few years to do, and some things would never work quite right. Possibly you can find a project that's tried to start that effort, although I would doubt it- android moves relatively rapidly for them to keep up, and j2me is basically dead.
As for resizing the screen of an APK file- you don't. APK files don't have a screen size. Instead the idea is to write a UI that scales.
I downloaded the Android studio and installed it. When I launched it, it's all "graphical". My screen reader is reading nothing on it.
I'd prefer if I could use my Notepad app, but the "stand alone" tutorials are too tiresome, and not many tutorials on the web have instructions making apps using Notepad. I wanted to know if there is an alternate IDE, or another way to code Android apps?
The Java IDE Eclipse is also not very compatible with my screen reader. I use JAWS screen reader by Freedom Scientific. I used to code Java desktop software using my Notepad, so I'm familiar with programming using Notepad.
Also, if I somehow figure out how to make Android apps using Notepad, how am I going to test them? Do I need a phone? I'm sorry for all these beginner questions, but I'm a beginner :)
You can follow this link:
http://developer.android.com/tools/building/building-cmdline.html
If you only want to build, not run, you don't need a phone. If you want test without a phone you can use an emulator by running"AVD Manager.exe" in Android SDK folder.
The good thing since the transition to android studio is that now the building of an android project is done using Gradle and can be piloted entirely by command line. So technically, you don't need an IDE at all.
Basically, every project has at least a build.gradle file that contains the instructions to build it. You only have to launch Gradle with the appropriate command to compile your app.
Yelliver mentionned the tools to build the app from the command line, there are also tools to create the project structure and the basic build files: http://developer.android.com/tools/projects/projects-cmdline.html (this documentation appears not to be entirely up-to-date, though, as it mentions the old project.properties format)
Having a phone to run your app is certainly going to be nicer and faster to develop. The emulator is far from perfect, quite slow, and sometimes not responsive. It is also easier to install other apps on your phone than on the emulator, in case your app interacts with other apps.
I wrote two small scripts for Android development without using Android Studio. They are building apk and installing it on the connected device and opening the logcat with the output of the installed application. This two scripts not even near to complete when to think all the features of the Android Studio but they are allowing to at least run the project on your phone.
I have few questions:
Is it possible to create an Android App with Java and setup all
myself?
If yes, what are the important things, that must a App have?
Is there a tutorial?
If someone want know why:
I want to understand all exactly and want to have the full control.
The Android SDK with eclipse have so many features(For the first small projects too many).
In the best case I want only link the Android library jar, but I think its not so easy and there are a few Mord things Like the App manifest ...
I hope someone understand me and can help me.
I want to understand all exactly
I doubt that there is anyone on the planet that understands it all exactly.
Is it possible to create an Android App with Java and setup all myself?
I do not know what "with Java" means here. Based on the rest of your question, I am interpreting this as:
Is it possible to create an Android application project without an IDE?
In that case, you are welcome to:
Create a project using android create project, designed to be built with Apache Ant, or
Create a project by copying an existing project or downloading a bootstrap project, then use android update project to create the Ant build files
If yes, what are the important things, that must a App have?
The android create project command will create a complete "Hello, world" application, ready to be run.
Is there a tutorial?
I will settle for pointing you to the documentation for creating and building projects on the command line, in hopes that perhaps that is what you are referring to.
I'm currently working on an Android application built with Adobe Air sdk, in AS3. I was wondering if it's possible to compile a kind of UI library that I can import in a Android native application (Java). Basically, I would like to build my UI with Adobe Air, but the main part of my application with Java, the native way.
What I have in mind is to convert the adobe air-generated APK into a Jar file I would import in the native application project, and call some functions that display something on the Screen.
Is it possible? I think it may be possible, because when I don't import Adobe Air SDK in the application, I must install Adobe Air application with the Play Store to make my application working. I don't find lot of things on Google about that :s.
Thank you for your help.
Yes it can be done (in theory), but hold on to your hat, it's a bumpy ride!
I see it is a very old question, with a new bounty (the questioner has not logged on for 3 years!), but here we go...
This method goes to the heart of how android java apps are constructed and run (i.e. DEX, so it will work with adobe-air or ANYTHING, it is fundamental [general method]). (by the way you use the word native in a confusing way, native is commonly understood to mean the JNI (c++) library element of an app).
You say:
"What I have in mind is to convert the adobe air-generated APK into a
Jar file I would import in the native application project, and call
some functions that display something on the Screen."
Android programs are compiled into .dex (Dalvik Executable)[now called ART but binary compatible] files,
which are in turn zipped into a single .apk file on the device (with other things like the manifest and resources). (unzip a .apk and look inside).
A .jar file contains DEX files (zipped). (unzip a compiled .jar and look inside).
I have done some work like this before, here's a link to a tutorial and coding examples [tested by me] (in android studio + gradle) [custom build elements are usually needed (I also give an ant example)].
See my stack-overflow answer Dynamic loading of DEX files
This in theory answers your question, but it's fundamental stuff, complex and has limitations that make it hard to code and maintain (resources are a real pain in the a**e).
Question: This all seems very complicated and hard !
Yes it is ! It is an increadably silly an difficult thing to do! That is why we invented cross platform frameworks, (and for web based code javascript/css/html5...). Failing that PORT the code.
I'm more of a Flash/AS3 coder than Java so can't give you a full answer but...
A better approach might be to just render your SWF-based User Interface itself via Java code (as opposed to compiling SWF into APK format then trying to embed Flash APK inside Android APK).
This way your SWF can also communicate with Java functions (via AS3's external Interface class). Making it easier to trigger Java functions when a button on the SWF U.I is pressed etc..
You just have to find an SWF render library for Java.
Maybe check out SWFTools. Particularly the SWF Class looks promising. I have not tested this library but it might help you.
I am not a Adobe AIR developer at all, however, I have developed a few Android App with both native environment and with some kind of framework (specifically PhoneGap). So, may this can help you.
I don't think that there would be any tool which could directly convert mobile apps build using frameworks like Adobe AIR, PhoneGap or any other HTML5 based framework to a native Android app because technically it is very difficult and unfeasible to do a proper mapping between each and every element of HTML5 (or Flex element in your case) to a corresponding native control or logic. The best you can do is use plugin mechanism provided by your framework to interact with Java and vice-versa and basically that is why the framework is there. For most of HTML5 based frameworks there is a plugin mechanism which allows developer to interact with native functionality (like Background Services, Activity or any other native resource). Even these frameworks are build using the same modular or plugin based approach and there major functionality (accessing Camera, Audio, SD Card etc native resources) works like this. We have to enable that feature before using that in our app.
So, look for plugin type of mechanism in Adobe AIR.
Hope this helps.
Maybe this is a dirty way to help you, but you can :
Install the adobe air program in one computer
Copy the files of the install folder of the adobe air program
Embed all this files in the java application
Install the java application
Save the adobe air files in one folder
Start the adobe air with java (like you will do it with the console, a simple call to YourAirApp.exe)
Edit - I know there are similar questions to this on SO, but I feel my specific questions are not duplicates at all. If you disagree with me please bring them to my attention before downnvoting or closevoting! If you can prove to me that my question is a true duplicate I will delete this question myself!
My understanding of the GWT is that it provides an SDK and API that allows you to code in Java, and it generates all the client-side HTML, CSS and JavaScript required to run a full-fledged web (or mobile web) app.
My understanding of PhoneGap is that it allows you to code against its JavaScript API and, through configuration, allows you to tell it which native mobile platforms (Android, iOS, Windows Phone, etc.) it should create nativee wrappers for. Hence you "write once, run many" with it, turning your JavaScript code into a native Android app, native iOS app, etc.
If these two assumption are incorrect, please begin by correcting me! And, if there are any caveats to these assumptions, please let me know!
Assuming my understanding on GWT and PhoneGap are more or less correct, I want to try and use them together for an app that would be available as (1) a web app, (2) a mobile web app, (3) an Android app and (4) as an iOS app.
I want to "daisy-chain" these two in my Ant build, whereby my pure Java code is converted (via GWT) into JavaScript (that complies to the PhoneGap API), and then a second build process uses PhoneGap to create and deploy:
A Java WAR (web and mobile web app)
An Android APK
An iOS binary (I believe this is an IPA file, but I may be wrong)
So with those as the "givens", here are my questions:
Is this possible? If not, why? Any way to hack- or juryrig-together a solution that forces this to work?
I've noticed something called gwt-phonegap - will I need this in order for my proposed solution to work, or would this library just be a "nice to have"? Why or why not?
Any other considerations I am not thinking of here? Other libraries or tools that would behoove me?
Note: I have heard (but am not asserting!) that Titanium is superior to PhoneGap. Titanium, however, is not free. And I am quite broke. Thanks in advance for any help here!
There is an open source project out there combining GWT & Phonegap to build mobile apps:
mgwt - http://www.m-gwt.com
There are many people out there using it to build mobile apps and there is quite a lot on documentation including videos there, especially this one:
http://www.youtube.com/watch?v=0V0CdhMFiao&feature=plcp