Android Question How to Make an APK

John Frederickson

New Member
Licensed User
Longtime User
I'm a beginner. I have searched throughout the Beginners' Guide and on the forums and have been unable to find out how to make an APK that can be transferred to the Android device after compiling. As I understand it, the APK is the executable that the Android uses. I see under the Projects tab there are six different compile options, but no explanation of them.
Thanks,
 

NJDude

Expert
Licensed User
Longtime User
The APK is created every time you compile the app, it will be located in the <Your_Project_Name>\Objects directory. The installation will be done by the IDE, it will install the app (APK) to the device or emulator.
 
Last edited:
Upvote 0

Beja

Expert
Licensed User
Longtime User
Hi, and welcome to B4A.
In the attached picture, you see the red circle. just click on it and your app will be compiled.. after finishing,
open the "Objects" folder and you will see your app there.

good luck
 

Attachments

  • compile.png
    7.9 KB · Views: 288
Upvote 0

John Frederickson

New Member
Licensed User
Longtime User
The APK is created every time you compile the app, it will be located in the <Your_Project_Name>\Objects directory. The installation will be done by the IDE, it will install the app (APK) to the device or emulator.
NJDude, thanks for the quick reply. I looked in the object directory and found the .apk. It had "RAPID_DEBUG" attached to the filename. I transferred it to the Android and clicked it. It said it installed, but I have no idea where. Although I really appreciate your earlier reply, can you tell me if there is documentation on how all this works (which of the six different compiles does what, compile (which one of the six should I use), transfer to the device, find and run it on the device)? Thanks again.
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
First of all, to create an app you MUST compile in RELEASE mode not DEBUG (debug mode is for testing and debugging purposes), and you don't have to manually transfer it or copy it, you just compile your app and the IDE will install it to the attached device or emulator; after the app has been installed you should see the icon on the screen.
 
Upvote 0

John Frederickson

New Member
Licensed User
Longtime User

I looked up Release Mode but there isn't anything about it in the Beginner's Guide. I also looked over the IDE and there is no mention of Release Mode. Is there documentation that covers this? I really appreciate you taking time with this.
Thanks
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Beginner's Guide chapter 4.2.13.3 Release and Release (obfuscated) modes.

To distribute your project you must compile it with:
- Relase
The debugger code will not be added to the apk file.
- Release (obfuscated)
The debugger code will not be added to the apk file.
But the program file will be modified, see below.
 
Upvote 0

SohailNasir

Member
Licensed User
Longtime User
Thanks NJDude , you solved my problem. Now I can make APK files.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Sorry for re-opening this question, but really I am thinking to be too idiot, in this point, at least. I solved in empirical way my question, but I decided to talk about this (mainly to understand whether I am so obsolete or not). Forgive me, my situation is that I want, for example, to give the app to a friend for testing. He has not B4a or B4Abridge, of course. First I want to test on a device what he has to do for installing the apk. So, in B4A, I set the compilation choice to "release". I have no device connected , or better, a device is connected to USB, but not to B4A with B4Abridge. Among the project options I don't find any "pure compile". If I compile without signing I don't find any apk, but just a temp.ap_. (BTW, if I rename it with apk extension and I copy to the device and install it, the device Os refuses to install it. (Ok, it is the "signature")). The only empirical way I found to solve my issue, is to execute a "compile and run", letting the Ide to give error because nothing connected. Then I find the apk, in the folder specified in previous discussion, and I can happily copy it to the device in one of its accessible folders, for example the "download" one. On the device, I have installed a file manager allowing to display the apk and, touching it, it is automatically installed. Apart the details on the device operations, my question is "What am I missing to be unable to obtain the apk with a "pure" compilation option?". Why shall i necessarily "compile and run"? Moreover, what the apk I did in this way is?. I mean: which are the drawbacks of distributing it in this way? Clearly it is freely distributable, but this is not the concern, in my case, for example. Thanks to anybody in advance.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Giovanni, what version of B4A are you using?

You should (if on 3.2 or later) see a drop down, with Release (Obfuscated) and then just hit the blue arrow which is on the left of the drop down.

Once you've got an apk you can email it to someone or put on Dropbox, etc.. and they can install it.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Thanks for your answer, my friend, but, sorry, the question is another. The problem is not to get an apk, obfuscated or not. Either the "Release" or the "Release obfuscated" make an apk. This is clear. But both, are exactly like the "compile and run", i.e. they need a device (or the emulator) connected. Otherwise they make the apk, ok, but, after they claim that they cannot locate a device for running it. The "problem" is the "run" that necessarily is invoked after compilation. It seemed strange to me, and insinuated the suspect to have not fully understood the situation. It is fairly a detail, not important at all. I posted this message just because, being used to other Ides, I was expecting something that just compiles, like VisualStudio, who can make the exe and also, optionally, run it in cascade. My actual problem was to have correctly understood the situation. Thanks again..
 
Upvote 0

MaFu

Well-Known Member
Licensed User
Longtime User
You can always use "Compile and run", even if no device or emulator is connected. After compilation (with or without device) you find the final apk in the "Objects" subfolder.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
ok. Thanks. It was what I noticed. Only I was thinking that this way was not the right way. As I see, it is so. No problem at all. Thanks.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…