Hi all.
I'm trying to develop an Android app (client that would connect with a
file server application via Bluetooth) using Java and Bluecove for my
final project. I could develop another J2SE client using Bluecove
without any problems, but the Android part is being a bit messy.
I'm using Mac OS X (10.6.8), Eclipse SDK (3.7.2), and HTC Desire A8181
(Android v2.2).
Following Mina's instructions in these emails...
(1)
http://groups.google.com/group/bluecove-developers/msg/847f714034b34126
(2)
http://comments.gmane.org/gmane.comp.java.bluecove.devel/32
... I downloaded "bluecove-2.1.1-SNAPSHOT.jar" and "bluecove-gpl-2.1.1-
SNAPSHOT.jar" from here:
(3)
http://snapshot.bluecove.org/distribution/download/2.1.1-SNAPSHOT/2.1.1-SNAPSHOT.63/
I extracted the "gpl.jar" content, deleted the libbluecove.so in it,
and built the jar file again. Then added the two .jar files to my
Eclipse project (Build path -> Configure build path -> Libraries ->
Add externarl jars), and manually created libs\armeabi folders and
copied the "libbluecove.so" file attached in (1) there.
The project compiled without problems. I used the telephone for
debugging, but the app crashed when calling the first class
(CodigoComm) that uses Bluecove. Here is the LogCat output:
04-06 19:37:31.119: W/ActivityThread(1671): Application
com.prueba.bluecove is waiting for the debugger on port 8100...
04-06 19:37:31.129: I/System.out(1671): Sending WAIT chunk
04-06 19:37:31.129: I/dalvikvm(1671): Debugger is active
04-06 19:37:31.329: I/System.out(1671): Debugger has connected
04-06 19:37:31.329: I/System.out(1671): waiting for debugger to
settle...
04-06 19:37:31.529: I/System.out(1671): waiting for debugger to
settle...
04-06 19:37:31.729: I/System.out(1671): waiting for debugger to
settle...
04-06 19:37:31.929: I/System.out(1671): waiting for debugger to
settle...
04-06 19:37:32.129: I/System.out(1671): waiting for debugger to
settle...
04-06 19:37:32.329: I/System.out(1671): waiting for debugger to
settle...
04-06 19:37:32.539: I/System.out(1671): waiting for debugger to
settle...
04-06 19:37:32.739: I/System.out(1671): waiting for debugger to
settle...
04-06 19:37:32.939: I/System.out(1671): waiting for debugger to
settle...
04-06 19:37:33.139: I/System.out(1671): debugger has settled (1349)
04-06 19:37:33.239: E/PruebaBluecoveActivity(1671): onCreate
04-06 19:37:33.279: E/PruebaBluecoveActivity(1671): onStart
04-06 19:37:46.429: W/dalvikvm(1671): VFY: unable to find class
referenced in signature (Ljavax/bluetooth/ServiceRecord;)
04-06 19:37:46.439: W/dalvikvm(1671): Unable to resolve superclass of
Lcom/prueba/bluecove/comm/CodigoComm; (107)
04-06 19:37:46.439: W/dalvikvm(1671): Link of class 'Lcom/prueba/
bluecove/comm/CodigoComm;' failed
04-06 19:37:46.439: E/dalvikvm(1671): Could not find class
'com.prueba.bluecove.comm.CodigoComm', referenced from method
com.prueba.bluecove.GestorComunicacion.onCreate
04-06 19:37:46.439: W/dalvikvm(1671): VFY: unable to resolve new-
instance 39 (Lcom/prueba/bluecove/comm/CodigoComm;) in Lcom/prueba/
bluecove/GestorComunicacion;
04-06 19:37:46.439: D/dalvikvm(1671): VFY: replacing opcode 0x22 at
0x0030
04-06 19:37:46.439: I/dalvikvm(1671): Failed resolving Lcom/prueba/
bluecove/comm/EstadoBusquedaServ; interface 97 'Ljavax/bluetooth/
DiscoveryListener;'
04-06 19:37:46.439: W/dalvikvm(1671): Link of class 'Lcom/prueba/
bluecove/comm/EstadoBusquedaServ;' failed
04-06 19:37:46.439: W/dalvikvm(1671): VFY: unable to resolve static
field 112 (PUT) in Lcom/prueba/bluecove/comm/EstadoBusquedaServ;
04-06 19:37:46.439: D/dalvikvm(1671): VFY: replacing opcode 0x60 at
0x003e
04-06 19:37:46.439: D/dalvikvm(1671): VFY: dead code 0x0032-0039 in
Lcom/prueba/bluecove/GestorComunicacion;.onCreate (Landroid/os/
Bundle;)V
04-06 19:37:46.449: D/dalvikvm(1671): VFY: dead code 0x0040-0042 in
Lcom/prueba/bluecove/GestorComunicacion;.onCreate (Landroid/os/
Bundle;)V
04-06 19:37:46.449: W/dalvikvm(1671): Unable to resolve superclass of
Lcom/prueba/bluecove/comm/CodigoComm; (107)
04-06 19:37:46.449: W/dalvikvm(1671): Link of class 'Lcom/prueba/
bluecove/comm/CodigoComm;' failed
04-06 19:37:46.449: E/dalvikvm(1671): Could not find class
'com.prueba.bluecove.comm.CodigoComm', referenced from method
com.prueba.bluecove.GestorComunicacion.onStart
04-06 19:37:46.449: W/dalvikvm(1671): VFY: unable to resolve new-
instance 39 (Lcom/prueba/bluecove/comm/CodigoComm;) in Lcom/prueba/
bluecove/GestorComunicacion;
04-06 19:37:46.449: D/dalvikvm(1671): VFY: replacing opcode 0x22 at
0x0004
04-06 19:37:46.449: I/dalvikvm(1671): Failed resolving Lcom/prueba/
bluecove/comm/EstadoBusquedaServ; interface 97 'Ljavax/bluetooth/
DiscoveryListener;'
04-06 19:37:46.449: W/dalvikvm(1671): Link of class 'Lcom/prueba/
bluecove/comm/EstadoBusquedaServ;' failed
04-06 19:37:46.449: W/dalvikvm(1671): VFY: unable to resolve static
field 112 (PUT) in Lcom/prueba/bluecove/comm/EstadoBusquedaServ;
04-06 19:37:46.449: D/dalvikvm(1671): VFY: replacing opcode 0x60 at
0x0012
04-06 19:37:46.449: D/dalvikvm(1671): VFY: dead code 0x0006-000d in
Lcom/prueba/bluecove/GestorComunicacion;.onStart ()V
04-06 19:37:46.449: D/dalvikvm(1671): VFY: dead code 0x0014-0016 in
Lcom/prueba/bluecove/GestorComunicacion;.onStart ()V
04-06 19:37:54.111: W/dalvikvm(1671): Unable to resolve superclass of
Lcom/prueba/bluecove/comm/CodigoComm; (107)
04-06 19:37:54.111: W/dalvikvm(1671): Link of class 'Lcom/prueba/
bluecove/comm/CodigoComm;' failed
04-06 19:37:57.715: D/AndroidRuntime(1671): Shutting down VM
04-06 19:37:57.715: W/dalvikvm(1671): threadid=1: thread exiting with
uncaught exception (group=0x400259f8)
04-06 19:37:57.769: E/AndroidRuntime(1671): FATAL EXCEPTION: main
04-06 19:37:57.769: E/AndroidRuntime(1671):
java.lang.NoClassDefFoundError: com.prueba.bluecove.comm.CodigoComm
04-06 19:37:57.769: E/AndroidRuntime(1671): at
com.prueba.bluecove.GestorComunicacion.onCreate(GestorComunicacion.java:
88)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1069)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2751)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2803)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
android.app.ActivityThread.access$2300(ActivityThread.java:135)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
android.os.Handler.dispatchMessage(Handler.java:99)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
android.os.Looper.loop(Looper.java:144)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
android.app.ActivityThread.main(ActivityThread.java:4937)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
java.lang.reflect.Method.invokeNative(Native Method)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
java.lang.reflect.Method.invoke(Method.java:521)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
dalvik.system.NativeStart.main(Native Method)
04-06 19:37:57.769: E/AndroidRuntime(1671): Caused by:
java.lang.ClassNotFoundException: com.prueba.bluecove.comm.CodigoComm
in loader dalvik.system.PathClassLoader[/data/app/
com.prueba.bluecove-1.apk]
04-06 19:37:57.769: E/AndroidRuntime(1671): at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
java.lang.ClassLoader.loadClass(ClassLoader.java:573)
04-06 19:37:57.769: E/AndroidRuntime(1671): at
java.lang.ClassLoader.loadClass(ClassLoader.java:532)
04-06 19:37:57.769: E/AndroidRuntime(1671): ... 14 more
04-06 19:38:01.279: I/Process(1671): Sending signal. PID: 1671 SIG: 9
04-06 19:38:01.419: E/PruebaBluecoveActivity(1686): onCreate
04-06 19:38:01.429: E/PruebaBluecoveActivity(1686): onStart
As far as I understand, it seems like the telephone doesn't know
anything about the Bluecove classes. Should the "libbluecove.so"
appear in the /system/lib folder of the HTC? It doesn't. Am I
including the .jar and .so files properly?
I've also tried downloading Bluecove's source code from here...
(4)
http://code.google.com/p/bluecove/source/browse/trunk/?r=3062
... and building the whole project myself using Maven 3.0.3, but "mvn
package" gets this error log:
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] bluecove-site-skin ................................ SUCCESS
[2.564s]
[INFO] bluecove-parent ................................... SUCCESS
[0.065s]
[INFO] bluecove .......................................... SUCCESS
[20.757s]
[INFO] bluecove-emu ...................................... SUCCESS
[18.379s]
[INFO] bluecove-tests .................................... SUCCESS
[1:03.864s]
[INFO] bluecove-emu-gui .................................. SUCCESS
[0.871s]
[INFO] bluecove-gpl ...................................... SUCCESS
[1.662s]
[INFO] bluecove-bluez .................................... SUCCESS
[4.134s]
[INFO] bluecove-android2 ................................. SUCCESS
[0.490s]
[INFO] bluecove-examples ................................. SUCCESS
[0.003s]
[INFO] dependency-fix .................................... SUCCESS
[0.209s]
[INFO] bluecove-tester-base .............................. SUCCESS
[0.418s]
[INFO] tck-agent ......................................... SUCCESS
[3.995s]
[INFO] bluecove-tester ................................... FAILURE
[2.537s]
[INFO] bluecove-tester-obex .............................. SKIPPED
[INFO] bluecove-microemu-starter ......................... SKIPPED
[INFO] obex-install ...................................... SKIPPED
[INFO] obex-server ....................................... SKIPPED
[INFO] distribution ...................................... SKIPPED
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2:00.763s
[INFO] Finished at: Fri Apr 06 20:07:34 CEST 2012
[INFO] Final Memory: 14M/81M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal com.pyx4me:j2me-maven-plugin:
2.0.3:package (default) on project bluecove-tester: Obfuscation failed
(result=1) -> [Help 1]
[ERROR]
Anyway, as "bluecove-2.1.1-SNAPSHOT.jar" and "bluecove-android2-2.1.1-
SNAPSHOT.jar" are generated, I replaced the other .jar files with
these ones, following the instructions here:
(5)
http://code.google.com/p/bluecove/source/browse/trunk/bluecove-android2/src/site/apt/index.apt
Same result. The app crashes when calling CodigoComm.
Do you have any idea of what may be happening?
Thanks in advance (and sorry for the long email)
Mariajo