Category Archives: Android

Android Studio: Signing Your APP for Release

Do the following to sign your APP in release mode:

  1. On the menu bar, click Build > Generate Signed APK.
  2. On the Generate Signed APK Wizard window, click Create new to create a new keystore.
    If you already have a keystore, go to step 4.
  3. On the New Key Store window, provide the required information as shown in figure 1.
    Your key should be valid for at least 25 years, so you can sign app updates with the same key through the lifespan of your app.
  4. On the Generate Signed APK Wizard window, select a keystore, a private key, and enter the passwords for both. Then click Next.
  5. On the next window, select a destination for the signed APK and click Finish.

For more details, see http://developer.android.com/tools/publishing/app-signing.html

Renaming Android Package

From time to time you may find you need to rename an android package while developing in Android Studio. There seem to be several explanations around the web. The following method seems to be the method that worked the first time everytime for me. Example, change package com.example.test to com.example.testing:

  1. Click Project in the left sections bar → the Project Pane will open.
  2. Select Java under src / main of the app with the package to be renamed.
  3. Click the Small Gear on Project Pane top action bar → an options menu will appear.
  4. Uncheck the Compact Empty Meddle Packages in the options menu → the directories under java will cascade down.
  5. Select the package name to change (ex: test) and right click → a dropdown menu will appear.
  6. In the dropdown menu, select Refactor / Rename → a window will appear
  7. In popup window, select Rename package → a window will appear
  8. Enter the new package name, click search in comments & strings and search for text occurances
  9. Press Refactor

Refactoring should replace all needed directory names, and references within your files, producing a new package.

Android: Add activity in Eclipse

Creating an Android Activity via Eclipse:

  • Double click on AndroidManifest.xml in the package explorer.
  • Click on the “Application” tab of the manifest editor
  • Click on “Add..” under the “Application Nodes” heading (bottom left of the screen)
  • Choose Activity from the list in the dialog that pops up (if you have the option, you want to create a new top-level element)
  • Click on the “Name*” link under the “Attributes for” header (bottom right of the window) to create a class for the new activity.

When you click Finish from the new class dialog, it’ll take you to your new activity class so you can start coding.