Category Archives: android

known trouble when using aapt

You have trouble using aapt. And following error is raised : java.io.IOException: Cannot run program “/opt/Android/Sdk/build-tools/22.0.1/aapt”: error=2, No such file or directory.
You are probably using aapt which is a 32bit application under a 64bit running ubuntu.
To get it working, simply install :

sudo apt-get install lib32stdc++6 lib32z1

android apk NoClassDefFoundError (gradle build)

My android application is build with gradle and my apk is generated and works correctly.
After some developpement iterations, i include android-support-v4.jar library to ide project and gradle build file like following:

Build with gradle and install apk on avd ==> NoClassDefFoundError (class which extends class located in android-support-v4.jar library)

Solution:

./gradlew clean

And it works again

onSwipe listener without using Swipe Views

1. create SimpleGestureFilter class containing interface SimpleGestureListener

And then, your Activity must implement SimpleGestureListener interface like following

Reference : here

resume android MediaPlayer after pause

To pause MediaPlayer use :

And to resume

play your apk file on android emulator

you have already installed android studio or android sdk.
you have already configure your avd (android virtual device)

1. list your AVDs

> cd $ANDROID_SDK_HOME
> ./tools/android list avds

result looks like

Available Android Virtual Devices:
Name: AVD_for_Nexus_S_by_Google
Path: /home/witr/.android/avd/AVD_for_Nexus_S_by_Google.avd
Target: Android 4.2.2 (API level 17)
ABI: armeabi-v7a
Skin: 480×800
———
Name: AVD_for_Galaxy_Nexus_by_Google
Path: /home/witr/.android/avd/AVD_for_Galaxy_Nexus_by_Google.avd
Target: Android 4.2.2 (API level 17)
ABI: armeabi-v7a
Skin: 720×1280

2. start emulator of @AVD_for_Galaxy_Nexus_by_Google

> ./tools/emulator @AVD_for_Galaxy_Nexus_by_Google

or

> ./tools/android avd

Then select your avd and click start

3. install your apk file
copy your apk file (e.g. myApplication.apk) in $ANDROID_SDK_HOME/platform-tools/
Once avd started, open new terminal and type

> cd $ANDROID_SDK_HOME/platform-tools
> ./adb install myApplication.apk

If install succeed you will have

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
2594 KB/s (326422 bytes in 0.122s)
pkg: /data/local/tmp/myApplication.apk
Success

4. launch your application in avd
go to your avd emulator and launch myApplication