NativeScript: ListPicker crash on Android on NS 6.1

Environment

  • CLI: 6.1
  • Cross-platform modules: 6.1.1
  • Android Runtime: 6.1.1
  • iOS Runtime: 6.1.0
  • Plugin(s):
    "nativescript-advanced-webview": "^3.0.2",
    "nativescript-angular": "^8.2.1",
    "nativescript-canvas": "^2.1.5",
    "nativescript-datetimepicker": "^1.2.1",
    "nativescript-drop-down": "^5.0.0",
    "nativescript-feedback": "^1.3.9",
    "nativescript-http-formdata": "^1.7.0",
    "nativescript-imagecropper": "^1.0.5",
    "nativescript-intl": "^3.0.0",
    "nativescript-iqkeyboardmanager": "^1.5.1",
    "nativescript-localize": "^4.1.1",
    "nativescript-mediafilepicker": "^2.0.16",
    "nativescript-pager": "^11.0.9",
    "nativescript-permissions": "^1.3.7",
    "nativescript-phone": "^1.4.0",
    "nativescript-platform-css": "^1.6.9",
    "nativescript-plugin-firebase": "^9.0.4",
    "nativescript-sqlite": "^2.3.3",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-listview": "^7.0.5",
    "nativescript-ui-sidedrawer": "7.0.0",

Describe the bug The ListPicker is working on iOS but not on Android, when i try to load a Page with a ListPicker on it i get the error:

System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onCreateView failed
System.err: TypeError: this.nativeView.getTextColor is not a function
System.err: 
System.err: StackTrace:
System.err:     push.../node_modules/tns-core-modules/ui/list-picker/list-picker.js.ListPicker.<computed>(file:///node_modules/tns-core-modules/ui/list-picker/list-picker.js:139:0)
System.err:     at applyAllNativeSetters(file:///node_modules/tns-core-modules/ui/core/properties/properties.js:1060:0)
System.err:     at initNativeView(file:///node_modules/tns-core-modules/ui/core/properties/properties.js:990:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.onResumeNativeUpdates(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:628:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase._resumeNativeUpdates(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:273:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.onLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:232:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view/view.js.View.onLoaded(file:///node_modules/tns-core-modules/ui/core/view/view.js:246:0)
System.err:     at (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:75)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callFunctionWithSuper(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:305:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.loadView(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:440:0)
System.err:     at (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:234:0)
System.err:     at push.../node_modules/tns-core-modules/ui/layouts/layout-base-common.js.LayoutBaseCommon.eachChildView(file:///node_modules/tns-core-modules/ui/layouts/layout-base-common.js:125:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view/view-common.js.ViewCommon.eachChild(file:///node_modules/tns-core-modules/ui/core/view/view-common.js:1010:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.onLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:233:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view/view.js.View.onLoaded(file:///node_modules/tns-core-modules/ui/core/view/view.js:246:0)
System.err:     at (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:75)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callFunctionWithSuper(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:305:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.loadView(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:440:0)
System.err:     at (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:234:0)
System.err:     at push.../node_modules/tns-core-modules/ui/layouts/layout-base-common.js.LayoutBaseCommon.eachChildView(file:///node_modules/tns-core-modules/ui/layouts/layout-base-common.js:125:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view/view-common.js.ViewCommon.eachChild(file:///node_modules/tns-core-modules/ui/core/view/view-common.js:1010:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.onLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:233:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view/view.js.View.onLoaded(file:///node_modules/tns-core-modules/ui/core/view/view.js:246:0)
System.err:     at (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:75)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callFunctionWithSuper(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:305:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.loadView(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:440:0)
System.err:     at (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:234:0)
System.err:     at push.../node_modules/tns-core-modules/ui/layouts/layout-base-common.js.LayoutBaseCommon.eachChildView(file:///node_modules/tns-core-modules/ui/layouts/layout-base-common.js:125:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view/view-common.js.ViewCommon.eachChild(file:///node_modules/tns-core-modules/ui/core/view/view-common.js:1010:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.onLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:233:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view/view.js.View.onLoaded(file:///node_modules/tns-core-modules/ui/core/view/view.js:246:0)
System.err:     at (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:75)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callFunctionWithSuper(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:305:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.loadView(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:440:0)
System.err:     at (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:234:0)
System.err:     at push.../node_modules/tns-core-modules/ui/content-view/content-view.js.ContentView.eachChildView(file:///node_modules/tns-core-modules/ui/content-view/content-view.js:70:0)
System.err:     at push.../node_modules/tns-core-modules/ui/page/page-common.js.PageBase.eachChildView(file:///node_modules/tns-core-modules/ui/page/page-common.js:126:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view/view-common.js.ViewCommon.eachChild(file:///node_modules/tns-core-modules/ui/core/view/view-common.js:1010:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.onLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:233:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view/view.js.View.onLoaded(file:///node_modules/tns-core-modules/ui/core/view/view.js:246:0)
System.err:     at push.../node_modules/tns-core-modules/ui/page/page.js.Page.onLoaded(file:///node_modules/tns-core-modules/ui/page/page.js:43:0)
System.err:     at (file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:75)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callFunctionWithSuper(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:305:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.callLoaded(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:312:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase.loadView(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:440:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase._addViewCore(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:435:0)
System.err:     at push.../node_modules/tns-core-modules/ui/core/view-base/view-base.js.ViewBase._addView(file:///node_modules/tns-core-modules/ui/core/view-base/view-base.js:421:0)
System.err:     at push.../node_modules/tns-core-modules/ui/frame/frame.js.FragmentCallbacksImplementation.onCreateView(file:///node_modules/tns-core-modules/ui/frame/frame.js:687:0)
System.err:     at push.../node_modules/tns-core-modules/ui/frame/fragment.js.FragmentClass.onCreateView(file:///node_modules/tns-core-modules/ui/frame/fragment.js:26:0)
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:1096)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1083)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1063)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1055)
System.err:     at com.tns.FragmentClass.onCreateView(FragmentClass.java:53)
System.err:     at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2595)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
System.err:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
System.err:     at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
System.err:     at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2076)
System.err:     at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1866)
System.err:     at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1821)
System.err:     at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
System.err:     at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
System.err:     at android.os.Handler.handleCallback(Handler.java:883)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:100)
System.err:     at android.os.Looper.loop(Looper.java:214)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:7343)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:933)

Searching in the code of this repository the problem appears to happen in the file tns-core-modules/ui/list-picker/list-picker.android.ts line 175.

To Reproduce Simply put a ListPicker with items in a page in an Angular project and run it on an Android Emulator API 29.

Expected behavior No error trying to use the ListPicker on Android projects.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 33 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Hello ! I have the same problem with the ListPicker here, however i don’t know how to update the compileSdkVersion and the buildToolsVersion on my project ! Someone here can help me out ? Thanks 😃

In your app.gradle file you should have something like this…

android {
compileSdkVersion 29 buildToolsVersion “29.0.2”

defaultConfig {
minSdkVersion 23 targetSdkVersion 29 generatedDensities = [] ///MUST BE SAME AS ANDROIDMANIFEST.XML applicationId “you app info” versionCode 7 versionName “505357” ndk { abiFilters “arm64-v8a”, “armeabi-v7a”, “x86_64”
} }

I also have the same issue on Android 10. looking into list-picker.android.js : tns-core-modules: 6.2.0

    ListPicker.prototype.initNativeView = function () {
        _super.prototype.initNativeView.call(this);
        initializeNativeClasses();
        var nativeView = this.nativeViewProtected;
        //if (sdkVersion() < 29) {
            this._selectorWheelPaint = getSelectorWheelPaint(nativeView);
        //}

comment out the sdkVersion check fix the problem. I checked the code in this module, if _selectorWheelPaint is not defined, quite some places may be broken.

Sorry my bad, i have to also delete node_modules for take the latest changes now is working fine, keep it closed

I had this exact issue earlier today while testing my app on an Android 10 device. Fixed it by updating android sdk build tools from 28.0.3 to 29.0.2.

I’m having the same issue on 6.5 and 6.1.2 … tried SDK update, node_modules delete, clean run and nothing

replace app.gradle like : android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { minSdkVersion 17 generatedDensities = [] } aaptOptions { additionalParameters "--no-version-vectors" } }

and replace to manifest like :

android:versionCode=“7” android:versionName=“505357”

and solved

Thank you for the continual reports by everyone here and speaking for the TSC, we apologize for the previous core team not addressing this sooner. We have published a fix for this in 6.5.15. Please feel free to ping back if you have any further issue after updating to at least that version.

I’m having the same issue on 6.5 and 6.1.2 … tried SDK update, node_modules delete, clean run and nothing

replace app.gradle like : android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { minSdkVersion 17 generatedDensities = [] } aaptOptions { additionalParameters "--no-version-vectors" } } and replace to manifest like : android:versionCode=“7” android:versionName=“505357” and solved

@pclokcer have you tried this on Android 10? Doubt it fixes it I have the same gradle config except minSdkVersion = 19 as we don’t need the earlier sdks

I tried and worked.

App was working fine until a few days ago when I updated my real device to latest android, just having a <ListPicker in the file would crash the app with the this.nativeView.getTextColor is not a function.

Stuff I did that did not help: sdkmanager --update

Can confirm it updated build tools to Darwin 29.3

deleted node_modules and rebuilt app, same issue. iOS is not affected even at latest update of 11.3 and working fine with new Xcode 11.3.1

The question in my mind what happens in the future when my users upgrade say to Android 11 will the app that should be legacy compatible break?

Halp thanks

Update: After a lot of fiddling and updates I deleted my node_modules and platforms and ran tns update This updated everything including web pack and core modules and tns android, and destroyed my theming because of dark mode BUT the list picker works now on android 29.3 can confirm no crash. After the update I ran: tns run android --clean

So I think the steps are follows: sdkmanager --update tns update tns run android --clean

I’m having the same issue on 6.5 and 6.1.2 … tried SDK update, node_modules delete, clean run and nothing

replace app.gradle like : android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { minSdkVersion 17 generatedDensities = [] } aaptOptions { additionalParameters "--no-version-vectors" } }

and replace to manifest like :

android:versionCode=“7” android:versionName=“505357”

and solved

Worked for me! Thanks!

Hi @MCurran16, Do you have a sample project, where the issue can be reproduced and can be used for debugging?