Archive for the ‘Development’ Category

Use adb to uninstall an APK from connected device

adb uninstall <package name>

Categories: Android, Development

“Debug certificate expired” error in Eclipse Android plugin

If a ‘clean’ on the project (go to Project -> Clean…) does not fix the error you have to delete your debug certificate under ~/.android/debug.keystore on Linux and Mac OS X resp. %USERPROFILE%/.android on Windows.

If you then build a debug package the Eclipse plugin should generate a new certificate.

Categories: Android, Development

Android scale drawable

Drawable scaledDrawable = getScaledDrawable(scaleLevel, scaleLevel, R.drawable.icon);

private Drawable getScaledDrawable(int newWidth, int newHeight, int id) {

Bitmap bitmap = BitmapFactory.decodeResource(this.getResources(), id);

Matrix matrix = new Matrix();
float scaleWidth = ((float) newWidth) / bitmap.getWidth();
float scaleHeight = ((float) newHeight) / bitmap.getHeight();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap scaledBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);

return new BitmapDrawable(this.getResources(), scaledBitmap);
Categories: Android, Development

Eclipse Problem “Android SDK: Resolving error markers…”

After the start of Eclipse i got the message “Android SDK: Resolving error markers’ has encountered a problem. Marker id 37074 not found.”

Clean all projects in your workspace and restart Eclipse to solve this problem.

Categories: Android, Development

Setting Android and Path environment variables on Mac OS X

December 21, 2011 2 comments

When bash starts it reads the following files every time you login. For the purposes of OS X, this means every time you open a new Terminal window.

  • /etc/profile
  • ~/.bash_profile
  • ~/.bash_login (if .bash_profile does not exist)
  • ~/.profile (if .bash_login does not exist)

When you start a new shell by typing bash on the command line, it reads .bashrc

Finally, OS X also uses ~/.MacOSX/environment.plist to set more environment variables, including paths if necessary.

Add Android and PATH variables to ~/.profile, e.g.:

export ANDROID_HOME=/Users/cduu/Development/bin/android-sdk/android-sdk_r15-macosx_x86
export PATH=/Users/cduu/Development/bin/android-sdk/android-sdk_r15-macosx_x86/platform-tools:/Users/cduu/Development/bin/android-sdk/android-sdk_r15-macosx_x86/tools:$PATH

Check environment variables in a new Terminal with:

Categories: Android, Development, Mac OS X

Java/Eclipse on Mac OS X: where is the source code for java

October 31, 2011 1 comment

The JDK installed by default does not have a src.jar. But if you install the ‘Java Developer package’ from Apple, you will get /Library/Java/JavaVirtualMachines/1.6.0_26-b03-384.jdk, which has src.jar under Contents/Home.

  • After installing the JDK point to it from your IDE.

Categories: Android, Development, Mac OS X

SQLiteManager for Android Eclipse plugin

October 3, 2011 1 comment

Download the sqlitemanager jar here, put it in the eclipse plugins folder and restart eclipse. By clicking the sqlitemanager icon on the top right of the File Explorer window you can see the table structure of the selected db file.

Here you can find a video how to use it. There is also a newer version available here.

Categories: Android, Development

ListView with thumb scroller (fast scroll)

To add the thumb scroller adjust your ListView like that:

<ListView android:layout_height="fill_parent" 

For more informations have a look at here and here.

Categories: Android, Development

Model Driven Software Development for Android

With the MDSDACP and the Android Content Provider Generation Eclipse Plugin it is possible to generate the Android Content Provider + Database + Model from an ecore domain model. It’s an Open Source Project under Eclipse Public License 1.0. For more informations have a look at the Project Home Page here.

Categories: Android, Development

LogCat doesn’t show anything

If the LogCat panel is empty in Eclipse the emulator (or your connected device) doesn’t have the focus. Go to the DDMS perspective and try clicking on the ’emulator’ entry in the Devices panel (top-left screen).

Categories: Android, Development