[fpc-devel] FPC-JVM: Status report on Android

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Aug 28 21:38:14 CEST 2011


On 27 Aug 2011, at 17:43, Sven Barth wrote:

> When running the full FPC application (or "activity"):
> 
> === begin run log ===
> 
> I/ActivityManager(   59): Start proc org.freepascal.helloworld for activity org.freepascal.helloworld/.THelloWorld: pid=601 uid=10035 gids={1015}
> D/dalvikvm(  601): newInstance failed: p0 i0 [0 a1
> D/AndroidRuntime(  601): Shutting down VM
> W/dalvikvm(  601): threadid=1: thread exiting with uncaught exception (group=0x40015560)
> E/AndroidRuntime(  601): FATAL EXCEPTION: main
> E/AndroidRuntime(  601): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.freepascal.helloworld/org.freepascal.helloworld.THelloWorld}: java.lang.InstantiationException: org.freepascal.helloworld.THelloWorld

Is this an expected exception?

> And here the log entry when building the Java based example with a class that derives from TObject:
> 
> === begin build log ===
> 
>     [echo] Converting compiled files and external libraries into /home/sven/projects/android/helloandroid/bin/classes.dex...
>    [apply]
>    [apply] UNEXPECTED TOP-LEVEL EXCEPTION:
>    [apply] com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type boolean. This is symptomatic of .class transformation tools that ignore local variable information.

Can you run the bytecode verifier on the class files generated for your program? See http://wiki.freepascal.org/FPC_JVM/Debugging#Bytecode_verification for the details. You may also have to add the android.jar to the class path for the verifier to work (although I'm not 100% certain whether that will work in case the android versions of java.lang.* start replacing the JDK versions of the same classes for running the verifier itself)

> <first-fpc-dalvik.png>

Nice :)


Jonas


More information about the fpc-devel mailing list