Closed cfficaurzua closed 5 years ago
Hi. I'm having the same issue here. Did you find a working way?
I'm also having the same issue too.
Waiting for any response.. (I have the same problem)
As usual: share a repo and I might take a look.
I have the same problem but unfortunately I can't share the repo but I think these are enough.
My main.js
import Vue from 'nativescript-vue'
import VueDevtools from 'nativescript-vue-devtools'
import firebase from 'nativescript-plugin-firebase'
import * as appSettings from 'tns-core-modules/application-settings'
import store from './store/main'
import App from './components/App'
if (TNS_ENV !== 'production') {
Vue.use(VueDevtools)
}
// Prints Vue logs when --env.production is *NOT* set while building
Vue.config.silent = (TNS_ENV === 'production')
firebase.init({
// Optionally pass in properties for database, authentication and cloud messaging,
// see their respective docs.
}).then(
() => {
// eslint-disable-next-line no-console
console.log('firebase.init done')
},
(error) => {
// eslint-disable-next-line no-console
console.log(`firebase.init error: ${error}`)
},
)
Vue.registerElement("MLKitBarcodeScanner", () => require("nativescript-plugin-firebase/mlkit/barcodescanning").MLKitBarcodeScanner)
new Vue({
store,
appSettings,
render: (h) => h('frame', [h(App)]),
}).$start()
And the error is the following
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to start activity ComponentInfo{MY_APP_ID/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: TypeError: Cannot read property 'FirebaseAnalytics' of undefined
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{MY_APP_ID/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: TypeError: Cannot read property 'FirebaseAnalytics' 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: Cannot read property 'FirebaseAnalytics' of undefined
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.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)
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2896)
System.err: ... 11 more
@gcacoutinho You are having this error because you have not install the package very well. You have to uninstall the package delete the platform folder and re-install the package.
After this navigate $ cd node-modules/nativescript-plugin-firebase
and run this command
$ npm run config
A prompt will display with options. You can accept according to your preferred use case using the y/n on your terminal.
After this you will have to update the firebase-nativescript.json this file contain settings of the features you will be using with your application.
Note: you must uninstall the previous package (because on init has already compile alot under the hood) if you already ran the $ tns run android or iOS command. You must also delete the platform or clear the overall cached. But i strongly recommend delete the platform folder.
@delino12 thanks for the quick response this is my firebase.nativescript.json
{
"external_push_client_only": false,
"using_ios": true,
"using_android": true,
"analytics": false,
"firestore": false,
"realtimedb": false,
"authentication": false,
"remote_config": false,
"performance_monitoring": false,
"messaging": false,
"in_app_messaging": false,
"crashlytics": false,
"storage": false,
"functions": false,
"facebook_auth": false,
"google_auth": false,
"admob": false,
"dynamic_links": false,
"ml_kit": true,
"ml_kit_text_recognition": false,
"ml_kit_barcode_scanning": true,
"ml_kit_face_detection": false,
"ml_kit_image_labeling": false,
"ml_kit_object_detection": false,
"ml_kit_custom_model": false,
"ml_kit_natural_language_identification": false,
"ml_kit_natural_language_translation": false,
"ml_kit_natural_language_smartreply": false
}
I think it looks fine but I'll delete and configure it again, since it could also be the cache causing the problem.
It's working fine now, I forgot to add the meta-data
to my AndroidManifest.xml
The meta-data
I am referring to (in my case):
<meta-data android:name="com.google.firebase.ml.vision.DEPENDENCIES"
android:value="barcode" />
NOTE: this is printed in the end of the firebase configuration script and varies accordingly
I have this error, I did what they recommend here but it didn't work for me.
@LuisSarmientoM Can you please upgrade to 10.0.2 and see if that helps?
tns-android version 5.4.0 angular: 8.0.0 nativescript: 8.0.0 nativescript-plugin-firebase: 8.3.2 tns-core-modules: ~5.4.0,
app.component.ts
then in a button on a tap event
I tried to delete the node_modules, platforms and reconfig firebase with no success if I uncomment this line
update_value[
customers_queue/${queue_n}/timestamp/] = firebase.ServerValue.TIMESTAMP
then i get an error saying that cant read Timestamp of undefined.