How to build an APK file in Eclipse?

539,099

Solution 1

When you run the project on the emulator, the APK file is generated in the bin directory. Keep in mind that just building the project (and not running it) will not output the APK file into the bin directory.

Solution 2

For testing on a device, you can connect the device using USB and run from Eclipse just as an emulator.

If you need to distribute the app, then use the export feature:

alt text

alt text

Then follow instructions. You will have to create a key in the process.

Solution 3

There is no need to create a key and so forth if you just want to play around with it on your device.

With Eclipse:

To export an unsigned .apk from Eclipse, right-click the project in the Package Explorer and select Android Tools -> Export Unsigned Application Package. Then specify the file location for the unsigned .apk.

Solution 4

The APK file is in the /workspace/PROJECT_FOLDER/bin directory. To install the APK file in a real device:

  1. Connect your real device with a PC/laptop.

  2. Go to sdk/tools/ using a terminal or command prompt.

  3. adb install <FILE PATH OF .APK FILE>

That's it...

Solution 5

Just right click on your project and then go to

*Export -> Android -> Export Android Application -> YOUR_PROJECT_NAME -> Create new key store path -> Fill the detail -> Set the .apk location -> Now you can get your .apk file*

Install it in your mobile.

Share:
539,099
sean
Author by

sean

Updated on July 10, 2022

Comments

  • sean
    sean almost 2 years

    When I develop the project using Eclipse, the APK file goes on the emulator. But I want to upload my application to a real device. Is there a tool to build an APK file?

    What is the process? Or is it possible to pull the APK file from the emulator?

  • Computerish
    Computerish over 13 years
    Remember that that APK is not signed with your developer private key, so you shouldn't distribute or or upload it to the market.
  • sergzach
    sergzach over 12 years
    So, and if we only would like to build it but not to start a noisy emulator?
  • sarnold
    sarnold about 12 years
    An anonymous user attempted to edit this post to include a note that this mechanism of getting an .apk file will get a debug build. If you want a release build, follow Sarwar's answer instead.
  • Admin
    Admin about 12 years
    and where is that bin's location ?
  • Salil Pandit
    Salil Pandit about 12 years
    @sergzach set run to Manual and when you hit play it'll list applicable devices / AVDs as soon as you have done this, the APK is created - you don't actually have to fire up the emulator. That said, sarnold is right Sanwar's answer is better for releasing the app.
  • Jarl
    Jarl over 11 years
    This seems like a good answer. However android lint errors prevent this from working... The standard "Run" action somehow succeeds in generating the apk file even with android lint errors.
  • shim
    shim over 11 years
    What if you want to distribute to beta testers?
  • Sarwar Erfan
    Sarwar Erfan over 11 years
    @shim: just give the apk files to beta testers. Or, host the apk files somewhere and give the url to the testers.
  • Rob Von Nesselrode
    Rob Von Nesselrode almost 11 years
    adb has moved to the directory "platform-tools". Not sure from which version of the SDK
  • talha2k
    talha2k almost 11 years
    I think you swaped the methods by mistake.
  • andy
    andy over 10 years
    to test this file, connect your Android device and type in commandline: "adb install ./myApp.apk"
  • Francisco Corrales Morales
    Francisco Corrales Morales about 10 years
    -1, reason: Yeah, but this question was about 'building an .apk from Eclipse', not how to test an .apk app
  • Francisco Corrales Morales
    Francisco Corrales Morales about 10 years
    Works, although it make the .apk even if there are errors (compilation, ...) which could be a bad or a good thing.
  • L. D. James
    L. D. James about 10 years
    The question was very clear of how to get the apk that he already has into a "real device". While all the other building, signing, and publishing suggestions are good suggestions, he can very easily get his apk that he already has in his emulator by downloading the current "apk" from his project sub-folder.
  • webgenius
    webgenius about 9 years
    Thanks for sharing. this is good enough for initial testing of the shared apk.
  • kpninja12
    kpninja12 over 8 years
    Thank you! That was driving me crazy
  • zionpi
    zionpi over 7 years
    this solution makes eclipse collapse too often,is there a script approach ?