Skip to content

Runtime tries to invoke method on non existing base class #445

Description

@blagoev

Bundle extends Object in Android 4.4 and Bundle extends BaseBundle on later android versions.
Invoking bundle.putInt() produces an error on devices running Android 4.4.4

The error is similar to this

MakeInstanceStrong (87, class android.os.Bundle)
D/TNS.Native(24250): RegisterInstance: Updating linked instance with its real class
D/TNS.Native(24250): SetClass called
D/TNS.Native(24250): ObjectManager::GetJSInstanceInfo: called
D/TNS.Native(24250): MetaDataEntry Method putInt's signature is: (Ljava/lang/String;I)V
D/TNS.Native(24250): CallJavaMethod called android/os/BaseBundle.putInt. Instance id: 807945176, isSuper=0
D/TNS.Native(24250): ObjectManager::GetJSInstanceInfo: called
D/TNS.Java(24250): Platform.getJavaObjectByID:87
W/dalvikvm(24250): JNI WARNING: can't call Landroid/os/BaseBundle;.putInt on instance of Landroid/os/Bundle; (CallVoidMethodA)
W/dalvikvm(24250): in Lcom/tns/Runtime;.callJSMethodNative:(IILjava/lang/String;IZ[Ljava/lang/Object;)Ljava/lang/Object; (CallVoidMethodA)
I/dalvikvm(24250): "main" prio=5 tid=1 RUNNABLE
I/dalvikvm(24250): | group="main" sCount=0 dsCount=0 obj=0x415efe58 self=0x4150c540
I/dalvikvm(24250): | sysTid=24250 nice=0 sched=0/0 cgrp=apps handle=1074233684
I/dalvikvm(24250): | state=R schedstat=( 1331894042 177783310 1766 ) utm=115 stm=18 core=1
I/dalvikvm(24250): at com.tns.Runtime.callJSMethodNative(Native Method)
I/dalvikvm(24250): at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:861)
I/dalvikvm(24250): at com.tns.Runtime.callJSMethodImpl(Runtime.java:726)
I/dalvikvm(24250): at com.tns.Runtime.callJSMethod(Runtime.java:712)
I/dalvikvm(24250): at com.tns.Runtime.callJSMethod(Runtime.java:693)
I/dalvikvm(24250): at com.tns.Runtime.callJSMethod(Runtime.java:683)
I/dalvikvm(24250): at com.tns.gen.android.app.Application_ActivityLifecycleCallbacks_ftns_modules_application_application_l33_c30__.onActivityResumed(Application_ActivityLifecycleCallbacks_ftns_modules_application_application_l33_c30__.java:24)
I/dalvikvm(24250): at android.app.Application.dispatchActivityResumed(Application.java:211)
I/dalvikvm(24250): at android.app.Activity.onResume(Activity.java:1109)
I/dalvikvm(24250): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1192)
I/dalvikvm(24250): at android.app.Activity.performResume(Activity.java:5327)
I/dalvikvm(24250): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2780)
I/dalvikvm(24250): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2819)
I/dalvikvm(24250): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2254)
I/dalvikvm(24250): at android.app.ActivityThread.access$800(ActivityThread.java:141)
I/dalvikvm(24250): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
I/dalvikvm(24250): at android.os.Handler.dispatchMessage(Handler.java:102)
I/dalvikvm(24250): at android.os.Looper.loop(Looper.java:136)
I/dalvikvm(24250): at android.app.ActivityThread.main(ActivityThread.java:5113)
I/dalvikvm(24250): at java.lang.reflect.Method.invokeNative(Native Method)
I/dalvikvm(24250): at java.lang.reflect.Method.invoke(Method.java:515)
I/dalvikvm(24250): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
I/dalvikvm(24250): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
I/dalvikvm(24250): at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(24250):
E/dalvikvm(24250): VM aborting
F/libc (24250): Fatal signal 6 (SIGABRT) at 0x00005eba (code=-6), thread 24250 (ivescript.myApp)
I/DEBUG ( 212): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 212): Build fingerprint: 'Xiaomi/2014819/HM2014819:4.4.4/KTU84P/V7.1.3.0.KHJMICK:user/release-keys'
I/DEBUG ( 212): Revision: '0'
I/DEBUG ( 212): pid: 24250, tid: 24250, name: ivescript.myApp >>> org.nativescript.myApp <<<

Activity

  1. blagoev commented on May 9, 2016

    @blagoev
    ContributorAuthor

    notice this line
    JNI WARNING: can't call Landroid/os/BaseBundle;.putInt on instance of Landroid/os/Bundle; (CallVoidMethodA)

  2. blagoev commented on May 9, 2016

    @blagoev
    ContributorAuthor

    This is related to this issue #404

  3. blagoev commented on May 9, 2016

    @blagoev
    ContributorAuthor

    In the Redmi 2 issue #404 the exact code is
    https://github.com/MiCode/patchrom_android/blob/ea109c17d1383df894adbb1e88b64c547d7e5989/base-framework/framework.jar.out/smali/android/os/Bundle%241.smali

    which indicates that Bundle extends Object and {N} runtime tries to invoke the putInt on BaseBundle class which is not present on that platform.

  4. calebeaires commented on May 9, 2016

    @calebeaires

    👍

  5. Plamen5kov commented on Sep 14, 2016

    @Plamen5kov
    Contributor

    We discussed this problem, and we updated the documentation with detailed explanation, what measures to take when supporting older devices. The updated documentation explaining dealing with metadata can be found here.

  6. added this to the 2.3.0 milestone on Sep 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions