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

Sven Barth pascaldragon at googlemail.com
Tue Aug 30 21:59:09 CEST 2011


On 30.08.2011 10:34, Jonas Maebe wrote:
>
> On 30 Aug 2011, at 10:16, Sven Barth wrote:
>
>> Am 30.08.2011 10:10, schrieb Jonas Maebe:
>>>
>>> Maybe you have to explicitly add "-g-" to the OPT string when compiling
>>> the RTL (and your programs), since the default config file shipped with
>>> the snapshot enables debug information.
>>
>> I have done that already, because I'm calling ppcjvm with "-n" option.
>> Or does the compiler look in its own directory first before it uses
>> the user config file?
>
> No, -n prevents loading any default configuration files.
>

I meant without the "-n", the default variant. Sorry for being unclear 
here ^^

>> The problem seems to be something else and I'll find it sooner or
>> later...
>
> There's a byte code verifier for dex files at
> http://dedexer.sourceforge.net/ (search for "-r"), maybe it can give a
> clearer diagnostic.
>

I'll take a look at the verifier.

In the meantime I've done my previously mentioned additional testing:
1. instantiate an android.app.Activity class inside Pascal code: works
2. derive a Pascal class from android.app.Activity (as is the case with 
the full Pascal example) and instantiate that: fails

The error message still happens during instantiation of the class, but 
the message looks a bit different then the other one:

=== log begin ===

I/ActivityManager(   62): Start proc com.example.helloandroid for 
activity com.example.helloandroid/.HelloAndroid: pid=375 uid=10034 
gids={1015}
W/dalvikvm(  375): VFY: new-instance on interface or abstract class 
Lorg/freepascal/android/TTestActivity;
D/dalvikvm(  375): VFY: replacing opcode 0x22 at 0x0000
D/dalvikvm(  375): VFY: dead code 0x0002-0018 in 
Lorg/freepascal/android/TTestClass;.getTextView 
(Landroid/app/Activity;)Landroid/widget/TextView;
D/AndroidRuntime(  375): Shutting down VM
W/dalvikvm(  375): threadid=1: thread exiting with uncaught exception 
(group=0x40015560)
E/AndroidRuntime(  375): FATAL EXCEPTION: main
E/AndroidRuntime(  375): java.lang.InstantiationError: 
org.freepascal.android.TTestActivity
E/AndroidRuntime(  375): 	at 
org.freepascal.android.TTestClass.getTextView(androidfpc.pas)
E/AndroidRuntime(  375): 	at 
com.example.helloandroid.HelloAndroid.onCreate(HelloAndroid.java:16)
E/AndroidRuntime(  375): 	at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(  375): 	at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime(  375): 	at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime(  375): 	at 
android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime(  375): 	at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime(  375): 	at 
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  375): 	at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  375): 	at 
android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime(  375): 	at 
java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  375): 	at 
java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(  375): 	at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(  375): 	at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(  375): 	at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(   62):   Force finishing activity 
com.example.helloandroid/.HelloAndroid
W/ActivityManager(   62): Activity pause timeout for 
HistoryRecord{406742f0 com.example.helloandroid/.HelloAndroid}
I/Process (  375): Sending signal. PID: 375 SIG: 9
I/ActivityManager(   62): Process com.example.helloandroid (pid 375) has 
died.

=== log end ===

The derived class is (on the Pascal side) a completely empty class. Just 
the class declaration is there. I'll test with a declared constructor.

Regards,
Sven



More information about the fpc-devel mailing list