NativeScript/firebase

Didn't find class "org.nativescript.plugins.firebase.MyFirebaseMessagingService"

serhiynovos opened this issue · 1 comments

Hi. I migrated from https://www.npmjs.com/package/@nativescript/firebase to this library and my Android app is crashing on first start

System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.nativescript.plugins.firebase.MyFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/~~ocMiaouPYeNwGKKk4NbYTg==/com..myapp-eVc6OSn4VyCnNl-kNry4MQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~ocMiaouPYeNwGKKk4NbYTg==/com..myapp-eVc6OSn4VyCnNl-kNry4MQ==/lib/x86_64, /data/app/~~ocMiaouPYeNwGKKk4NbYTg==/com.*******.mysapp-eVc6OSn4VyCnNl-kNry4MQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]

Here is my package.json file

"name": "my app",
"version": "1.0.3",
"description": "My Application",
"author": "My",
"license": "MIT",
"scripts": {
  "ios:emulator": "tn run ios --emulator",
  "android:emulator": "ns run android --emulator",
  "release-android-build": "ts-node ${PWD}/ops/publish_android_build.ts"
},
"dependencies": {
  "@nativescript-community/ui-collectionview": "4.0.70",
  "@nativescript-community/ui-material-bottomsheet": "7.0.42",
  "@nativescript-community/ui-material-button": "7.0.42",
  "@nativescript-community/ui-material-ripple": "7.0.42",
  "@nativescript/appversion": "2.0.0",
  "@nativescript/background-http": "6.0.0",
  "@nativescript/camera": "^5.0.15",
  "@nativescript/core": "8.5.0",
  "@nativescript/datetimepicker": "2.1.11",
  "@nativescript/email": "2.0.5",
  "@nativescript/firebase-analytics": "^2.5.2",
  "@nativescript/firebase-core": "^2.5.2",
  "@nativescript/firebase-crashlytics": "^2.5.2",
  "@nativescript/firebase-messaging": "^2.5.2",
  "@nativescript/google-maps": "1.4.10",
  "@nativescript/localize": "5.0.4",
  "@nativescript/social-share": "2.3.0",
  "@nativescript/theme": "3.0.2",
  "@nstudio/nativescript-cardview": "2.0.2",
  "@nstudio/nativescript-carousel": "8.0.3",
  "@nstudio/nativescript-pulltorefresh": "3.0.2",
  "@ticnat/nativescript-image-cache": "1.0.7",
  "@triniwiz/nativescript-image-zoom": "4.1.3",
  "axios": "^0.27.2",
  "fs-extra": "11.1.0",
  "jwt-decode": "3.1.2",
  "nativescript-audio": "6.2.6",
  "nativescript-clipboard": "2.1.1",
  "nativescript-numeric-keyboard": "5.0.2",
  "nativescript-permissions": "1.3.12",
  "nativescript-qr-generator": "3.0.0",
  "nativescript-taptic-engine": "2.1.0",
  "nativescript-ui-chart": "14.2.1",
  "nativescript-urlhandler": "1.3.0-master-31",
  "nativescript-uuid": "0.0.1",
  "nativescript-videoplayer": "5.0.1",
  "nativescript-vue": "2.9.3",
  "nativescript-vue-lifecycle-hooks": "1.0.0",
  "nativescript-windowed-modal": "7.0.0",
  "querystring": "0.2.1",
  "url-parse": "1.5.10",
  "vue-class-component": "7.2.6",
  "vue-property-decorator": "7.3.0",
  "vuex": "3.6.2",
  "x2js": "3.4.4",
  "xml-escape": "1.1.0"
},
"devDependencies": {
  "@babel/core": "^7.11.4",
  "@babel/preset-env": "^7.11.0",
  "@nativescript/android": "^8.4.0",
  "@nativescript/ios": "^8.4.0",
  "@nativescript/webpack": "~5.0.6",
  "babel-loader": "^8.0.2",
  "nativescript-vue-template-compiler": "2.9.3",
  "typescript": "^3.9.7"
},
"main": "./app/main.js"
}

Ok. I found what was the problem.

If anybody will face the same don't forget to remove next lines from AndroidManifest.xml

  <service android:name="org.nativescript.plugins.firebase.MyFirebaseInstanceIDService" android:exported="false">
         <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
         </intent-filter>
      </service>
      <service android:name="org.nativescript.plugins.firebase.MyFirebaseMessagingService" android:exported="false">
         <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
         </intent-filter>
      </service>