Archive

Archive for the ‘Development’ Category

Use adb to uninstall an APK from connected device

adb uninstall <package name>

Advertisements
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);
matrix.postRotate(0);
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:

set
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