nativescript-bottombar
nativescript-bottombar copied to clipboard
[Nativescript 6.0 upgrade] Could not load view for: nativebottombar. Cannot read property 'widget' of undefined
Nativescript-vue
Which platform(s) does your issue occur on?
- Android
- 9.0
- Device
Please, provide the following version numbers that your issue occurs with:
- CLI: 6.0.1
- Cross-platform modules: 6.0.1
- Runtime(s): tns-android.version == 6.0.0
- Plugin(s):
"dependencies": {
"@vue/devtools": "^5.0.6",
"axios": "^0.19.0",
"nativescript-bottombar": "^4.0.0-rc1.2",
"nativescript-masked-text-field": "^4.0.2",
"nativescript-plugin-firebase": "9.0.2",
"nativescript-socketio": "^3.2.1",
"nativescript-toasty": "^1.3.0",
"nativescript-ui-listview": "7.0.0",
"nativescript-vue": "^2.0.0",
"nativescript-vue-devtools": "^1.2.0",
"nativescript-zxing": "^1.5.8",
"net": "^1.0.2",
"tns-core-modules": "6.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.2",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^4.5.2",
"css-loader": "^1.0.0",
"lazy": "1.0.11",
"nativescript-dev-webpack": "next",
"nativescript-vue-template-compiler": "^2.0.0",
"nativescript-worker-loader": "~0.9.0",
"node-sass": "^4.9.2",
"sass-loader": "^7.1.0",
"terser-webpack-plugin": "^1.1.0",
"vue-loader": "^15.2.6",
"webpack": "^4.16.4",
"webpack-bundle-analyzer": "~2.13.1",
"webpack-cli": "^3.1.0"
}
Please, tell us how to recreate the issue in as much detail as possible.
I've upgraded from 5.0.0 to 6.0.0; This crashed my app. I can't build. I'm receiving this error when I run tns run android --bundle
:
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to start activity ComponentInfo{mpb.mpbpay/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: TypeError: Could not load view for: nativebottombar. TypeError: Cannot read property 'widget' of undefined
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{mpb.mpbpay/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: TypeError: Could not load view for: nativebottombar. TypeError: Cannot read property 'widget' of undefined
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2916)
System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3051)
System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1811)
System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
System.err: at android.os.Looper.loop(Looper.java:193)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6694)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err: Caused by: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: TypeError: Could not load view for: nativebottombar. TypeError: Cannot read property 'widget' of undefined
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1122)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1109)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1089)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1081)
System.err: at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:19)
System.err: at android.app.Activity.performCreate(Activity.java:7136)
System.err: at android.app.Activity.performCreate(Activity.java:7127)
System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
Hello @fabioaraujo121 ,
Thank you for reporting this issue.
This plugin hasn't been tested against v6 yet. After testing it with v6 I'll be able to come back to you to fix your issue.
Regards
Are there any updates regarding this problem? If anyone found a solution would you mind sharing it?
Ok found the solution.
Use android material library dependency
dependencies {
implementation "com.google.android.material:material:1.1.0-alpha07"
}
Navigate to nativescript-bottombar/src/bottombar/android/bottombar.js and change to this from android.support
var BottomNavigationView = com.google.android.material.bottomnavigation.BottomNavigationView;
This is a quick fix. Hope the author will fix it later.
Thanks man @amizz! You saved my day