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

Sven Barth pascaldragon at googlemail.com
Sun Aug 28 22:16:58 CEST 2011


On 28.08.2011 21:38, Jonas Maebe wrote:
>
> 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?
>

I'd say that it isn't an expected one... at least the converted class 
doesn't contain a "throws" comment at its constructor...

>> 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)

I don't think using the verifier on my own class files will be of much 
use, because if I understand the log correct it complains about the code 
in FpcBitSet.containsAll (mentioned in the last few lines before the 
next empty one). Also - regarding your android.jar comment - I'm not 
even using any Android classes in that example... just TObject (as a 
base class) and UnicodeString (it tried to convert all RTL classes, 
because I put the complete RTL in the projects bin directory, in which 
all contained .class files are converted).

Regards,
SVen



More information about the fpc-devel mailing list