Archive
Use adb to uninstall an APK from connected device
adb uninstall <package name>
“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.
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); } ...
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.
Setting Android and Path environment variables on Mac OS X
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
Java/Eclipse on Mac OS X: where is the source code for java
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.
- Download the latest Java Developer Package in the Apple Download Center for Developers and install it.
- After installing the JDK point to it from your IDE.
SQLiteManager for Android Eclipse plugin
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.
ListView with thumb scroller (fast scroll)
To add the thumb scroller adjust your ListView like that:
<ListView android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/android:list"
android:fastScrollEnabled="true"></ListView>
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.
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).