Hi, Luciano and me have been trying to run the SCA calculator sample on the Google Android platform, that is a platform for mobile devices. As the Android platform apps are written in Java language, we tried to run the Java SCA calculator sample on it.
Although the apps for Android are coded in Java, it's only coded in Java language. When it's compiled, it generates not .class files, but a file called .dex, that is equivalent to .jar files. The .dex files are not compound of Java standard bytecode, but a special bytecode that is intended to run only on Android VM: Dalvik. So, in our first try to compile the calculator sample, only importing the needed SCA jars were not successful, because the SCA jars are compiled using JDK compiler and do not have the Android special bytecode format. Fortunately, when you import the SCA jars into an eclipse Android project, it automatically tries to convert the JDK bytecode to Android bytecode before execute it. But something was not going correctly yet, cause when it tries to execute the service I get this exception: Application Error: com.android.hello An error in com.android.hello. Unnable to start activity ComponentInfo{com.android.hello/com.android.hello.HelloAndroid]: org.osoa.sca.ServiceRuntimeException: java.lang.NullPointerException. I wasn't sure about what was happening, and then I tried another approach: not import the SCA jars, but place the SCA source code needed by the calculator sample into the Android app src folder. This way the SCA would be compiled directly to Android bytecode. Unfortunately, the Android is not Java and does not have the entire set of classes that J2SE provides. It provides only some java classes as java.langand java.util classes which Android developers kept with the same package/class names and method signature for easy portability of Java app codes. So, the common Java classes used on Java SCA were compatible. But, the Java SCA uses a lot the javax.xml package and Android implements only part of this package on its platform, so I was getting a lot of errors because the missing classes that should be contained in this package. I solved it downloading the StAX source code and JDK javax.xml API source code, and placing it directly on my Android app project. Finally I got it compiled. Then, I got another error. I found out that the Android compiler fist compile the Java code to .class files and then compile the .class files to a .dex file. The first process everything goes fine, meaning the package dependencies and code syntax are OK. But on the second process, when it tries convert the .class files to .dex, I get 4 warnings and 1 error that are lightly described: *[2008-03-14 14:25:27 - HelloAndroid] trouble processing: [2008-03-14 14:25:27 - HelloAndroid] truncated annotation attribute ...while parsing RuntimeVisibleAnnotations attribute at offset 00000175 ...while parsing attributes[1] ...while parsing javax/xml/bind/annotation/XmlNs.class ...while processing javax/xml/bind/annotation/XmlNs.class [2008-03-14 14:25:27 - HelloAndroid] trouble processing: [2008-03-14 14:25:27 - HelloAndroid] truncated annotation attribute ...while parsing AnnotationDefault attribute at offset 000002b8 ...while parsing attributes[0] ...while parsing methods[0] ...while parsing javax/xml/bind/annotation/XmlSchema.class ...while processing javax/xml/bind/annotation/XmlSchema.class [2008-03-14 14:25:28 - HelloAndroid] trouble processing: [2008-03-14 14:25:28 - HelloAndroid] truncated annotation attribute ...while parsing AnnotationDefault attribute at offset 00000204 ...while parsing attributes[0] ...while parsing methods[2] ...while parsing javax/xml/ws/Action.class ...while processing javax/xml/ws/Action.class [2008-03-14 14:25:29 - HelloAndroid] trouble processing: [2008-03-14 14:25:29 - HelloAndroid] truncated annotation attribute ...while parsing AnnotationDefault attribute at offset 0000020b ...while parsing attributes[1] ...while parsing methods[0] ...while parsing org/osoa/sca/annotations/Service.class ...while processing org/osoa/sca/annotations/Service.class [2008-03-14 14:25:30 - HelloAndroid] 4 warnings [2008-03-14 14:25:30 - HelloAndroid] trouble writing output: not found [2008-03-14 14:25:30 - HelloAndroid] Conversion to Dalvik format failed with error 2 * So, I got nothing running so far : ( . Is there anyone with some Android knowledge that could help us with it? I will probably send this doubts to Android community and see if they can help us : ) Thanks in advance ; ) Adriano Crestani