Majikero Gallardo
Majikero Gallardo

Reputation: 143

Android getting .apk file

Why my .apk in bin folder are disappearing when I close my emulator and cleaning project and it appear again when emulator is open? I don't know when is the safe to copy the .apk file.

  1. When I close emulator (NOT CLEAN PROJECT) and the .apk is there?
  2. When my app is running to my emulator and copying the .apk file?
  3. The (export) unsigned Application package and save in different location?
  4. The (import) unsigned Application " " " " " "

Sometimes I installed apk file without problem in my Phone somtime NOT.

Upvotes: 0

Views: 102

Answers (3)

vman
vman

Reputation: 1274

Are you using Eclipse?

There are a few important settings:

a. Window > Preferences > Android > Build > "Skip packaging and dexing until export or launch" - if this is selected, APK is only generated when the application is launched onto a device/emulator.

b. Project > Build Automatically - The project will automatically be built after changes in the code

c. (only if b is not selected) Project > Clean... > "Start build automatically" - When you do a clean, a build is also done.

After every clean, the APK will disappear.

If setting (a) is checked, any time your project is cleaned or rebuilt (after a manual/automatic build) the APK may be removed. The APK is generated when you launch the application onto the emulator/device.

If you want to create an APK without launching, uncheck (a).

In summary, if you want to store your APK do the following:

  1. Clean/Build the project
  2. Stop making modifications to the code (if build automatically is checked) and do not clean/build anymore
  3. Make Eclipse generate the APK by launching application on emulator/device (You can skip this step if setting (a) is unchecked)
  4. Save the APK
  5. Continue working

Upvotes: 0

Chris Stratton
Chris Stratton

Reputation: 40337

While it's true that the proper purposes for a debug .apk are limited (app stores won't accept it, user data is completely unsecured, and it will expire inside a year), that is indeed a valid apk you can use for some temporary testing purposes.

Two things govern the existence of that file:

  • A "clean" operation should remove all build objects, including of course the .apk

  • The android tools are usually configured so that the automatic build process does not include generation of a debug .apk, and that instead only happens (by default) when you go to deploy on a device/emulator.

Therefore, you can grab the temporary debug .apk out of the bin folder any time between having deployed and having cleaned, regardless if your emulator or device is still running/connected or not.

Examining the timestamp on the .apk file as you try these various operations would be a way you can confirm this for yourself.

Upvotes: 1

dan983
dan983

Reputation: 494

It really depends on what you want the .apk for. If you want to distribute it via the Google Play store or on a server you'll want to export a signed application. If it's for personal use just run it on your phone using your phone as a debug device.

Upvotes: 0

Related Questions