java.lang.NoSuchMethodError: no non-static method "Landroid/view/View;.getForeground()Landroid/graphics/drawable/Drawable;" on LoliPop
Closed this issue · 1 comments
gogoout commented
Crashed on Android v5.0
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to start activity ComponentInfo{kiwi.allgoods.tnslocal/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
Calling js method onStart failed
Error: java.lang.NoSuchMethodError: no non-static method "Landroid/view/View;.getForeground()Landroid/graphics/drawable/Drawable;"
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116)
com.tns.Runtime.callJSMethodImpl(Runtime.java:996)
com.tns.Runtime.callJSMethod(Runtime.java:983)
com.tns.Runtime.callJSMethod(Runtime.java:967)
com.tns.Runtime.callJSMethod(Runtime.java:959)
com.tns.NativeScriptActivity.onStart(NativeScriptActivity.java:49)
android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)
android.app.Activity.performStart(Activity.java:6258)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2621)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2723)
android.app.ActivityThread.access$900(ActivityThread.java:172)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:145)
android.app.ActivityThread.main(ActivityThread.java:5832)
java.lang.reflect.Method.invoke(Native Method)
java.lang.reflect.Method.invoke(Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
File: "file:///data/data/kiwi.allgoods.tnslocal/files/app/bundle.js, line: 1, column: 8912
Turns out the setForeground is introduced after API VERSION 23.
Change the source code to below solved the bug.
const MARSHMALLOW = 23;
if (android.os.Build.VERSION.SDK_INT >= MARSHMALLOW) {
edusperoni commented
Thanks for the report. This is fixed on version 2.0.1