john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

development with eclipse

After downloading and installing eclipse...

(64bit linux users note Google use 32 bit libraries: apt-get install ia32-libs)

  1. http://developer.android.com/sdk/installing.html
  2. http://developer.android.com/sdk/index.html (download the SDK for your development machine)
  3. Eclipse -> Help > Install New Software
  4. Add (repository) -> https://dl-ssl.google.com/android/eclipse/
  5. Choose what to install (the black triangle can expand to show the Android Development Tools) (Ensure you select the SDK that was downloaded/installed in steps 1 + 2 , WinUsers = c:\Program Files(x86)\Android)
  6. Eclipse restart -> after choose which target (again, i.e. 2.1 for older devices, 4.0 for newer) (Windows Users: Start -> All Programs -> Android SDK Tools -> Android SDK Manager (right click and run as administrator)
  7. Hopefully can ignore the adb version fail error Error: 'adb version' failed! /home/ubuntu/android-sdks/platform-tools/adb: error while loading shared libraries: libncurses.so.5: wrong ELF class: ELFCLASS64 Failed to parse the output of 'adb version'
  8. Updates + capabilities can be managed in Eclipse -> Window -> Android SDK Manager

Eclipse -> Windows -> AVD Manager (android virtual device) -> New

  • name: my_avd , target: Android 2.2

Eclipse -> File -> New Project -> Android (since ADT is successfully installed)

  • Project name: hi-android , target: Android 2.2 , Application name: HiAndroid ,
  • Package name: com.example.hiandroid, ActivityName: HiAndroidActivity

(Activity = subclass of Android's Activity class which can run and do work, the user only interacts with one activity at a time)


package net.kittyandbear.hiandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HiAndroidActivity extends Activity 
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate( Bundle savedInstanceState ) 
    {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.main );
        TextView tv = new TextView( this );
        tv.setText( "I lub Bobby!" );
        setContentView( tv );        
    }
}

onCreate() method is called by the Android system when your Activity starts — it is where you should perform all initialization and UI setup


Eclipse -> right click on Project and choose Export -> Android -> Export Android Application -> Create new keystore (25 year, androidkeystore and password) -> Use a new key ( with password) -> Finish (destination for the .apk file)

http://developer.android.com/guide/publishing/app-signing.html

Use usb or other method to copy the .apk to your Android device (hopefully if you used the 2.2 framework you have a 2.2 device)

Android App "Easy Installer" makes it easier to install/run your .apk directly

Click on the App and see the text!


If you want to access the emulator sdcard files Window -> Perspective -> Other -> DDMS (Dalvik Debug Monitor Server)

(or type ddms from the command line in /tools)

Typically DDMS assigns port 8600 for the first debuggable VM

The DDMS "base port" (8700, by default) is a port forwarder which can accept VM traffic from any debugging port and forward it to the debugger on port 8700.

Update Heap
Start Tracking

From the Devices tab select the Emulator (VM), then select the File Explorer tab

The arrow device symbols in the top right corner allow you to "push a file" and "pull a file"

If you get "read only file system" when trying to push a file to the /mnt/sdcard folder then your VM/app may not have the sdcard feature enabled

Check in Eclipse -> Window -> AVD Manager


  • « Ldap distinguishedname ldapsearch memberof group
  • todo 0.1 »

Published

Apr 26, 2012

Category

android

~500 words

Tags

  • android 9
  • development 2
  • eclipse 22
  • java 252