How to Create an APK

Post on 27-Dec-2015

24 views 0 download

Tags:

description

apk

Transcript of How to Create an APK

How to create an APK (ADT Bundle) Last Updated: Sep 04, 2013 04:39PM PDT

With the ADT (Android Developer Tools) Bundle, Google has made it easy for new developers to create

Android apps. The ADT Bundle includes the essential Android SDK components and a version of the

Eclipse IDE with built-in ADT (Android Developer Tools). This tutorial will walk you through creating a

basic Android application, integrating the TestFlight Android SDK, and signing an Android application.

Requirements:

o A TestFlight developer account (Sign up here)

o The latest TestFlight Android SDK release

o ADT (Android Developer Tools) Bundle

Creating the Basic Application:

1. Launch Eclipse from the ADT Bundle (adt-bundle-

<os_platform>/eclipse/ directory).

2. Create a new Android Application Project.

3. Fill in the New Android Application form.

4. Leave the default settings in the Configure Project and Configure Launcher Icon windows.

5. Select Blank Activity and then click Finish.

6. Your Android project is now set up with some default files and you’re ready to run your HelloWorld

app on a real device or Android Emulator.

Integrating the TestFlight Android SDK

1. Download and unpack the TestFlight Android SDK ZIP file.

2. Add TestFlightLib.jar as a dependency to your Android application by dragging TestFlightLib.jar into

the libsdirectory.

3. Confirm the TestFlightLib.jar move by selecting Copy files in the File Operation window.

4. Create a new application class by selecting the package in the src directory and going to New > Class.

5. Enter the name of the application class in the Name field. For this example, use MyApplication as the

application class.

6. Import TestFlight into your main application class and call takeOff in the onCreate method of the

MyApplication class, passing your unique app token. To get your app token, create or go to your app in the

dashboard and click "App Token". 7. import android.app.Application; 8. import com.testflightapp.lib.TestFlight; 9. 10. public class MyApplication extends Application { 11. @Override

12. public void onCreate() { 13. super.onCreate(); 14. //Initialize TestFlight with your app token. 15. TestFlight.takeOff(this, "YOUR_APP_TOKEN"); 16. } 17. }

18. Update the AndroidManifest.xml file to point to the MyApplication class and grant

the permissions INTERNET and ACCESS_NETWORK_STATE. 19. <manifest ...> 20. <application ... android:name="MyApplication"> 21. ... 22. </application> 23. <uses-permission android:name="android.permission.INTERNET"/> 24. <uses-permission

android:name="android.permission.ACCESS_NETWORK_STATE"/> 25. </manifest>

Generate and sign the APK: The Android system requires that all installed applications be digitally signed with a certificate. Android

applications can either be signed with a release certificate or debug certificate. You should sign your

applications with a debug certificate while developing and testing in TestFlight. When you're ready to

distribute a release build or publish on an application marketplace such as Google Play, you should sign

your application with a release certificate.

Signing with a Debug Certificate:

1. Go to File > Export.

2. From the Export window, go to Android > Export Android Application.

3. Click Browse... and select the Android Application project to Export.

4. Click Browse and select the debug.keystore. The default location for debug.key store on OSX is

"/Users/<user>/.android/debug.keystore" and the password is "android". When you're ready to release your

app to an application marketplace, you should use an existing keystore or create a new keystore.

5. Select the "androiddebugkey" alias and use "android" as the password.

6. Select a destination for the APK file and click Finish.

7. You are now ready to upload and distribute the APK through TestFlight.

To learn more about the TestFlight Android SDK, please see the article here.