Comments (42)
@maddy2get basically what @comporell has posted above.
Your platform/app/build.gradle
needs to have apply plugin: "com.google.gms.google-services"
and your
platform/build.gradle
needs to contain dependencies { classpath "com.google.gms:google-services:4.3.4"}
I use an after-prepare
hook script to write these two lines to their respective files. This is necessary for me as I use CI/CD for my builds. If you don't use a CI/CD you can manually update the build files with the lines above.
`
from nativescript-plugin-firebase.
Same issue here with vanilla JS.
from nativescript-plugin-firebase.
@SingleMalted I've encountered this same problem but I'm confused by your description of the locations. I have a {N} 8.2 JS project, and I don't have (or can't find) a
platform/app/build.gradle
file. Would that beplatforms/android/build.gradle
? Nor do I seem to have what you describe as the rootbuild.gradle
- maybeApp_Resources/Android/app.gradle
or perhapsApp_resources/Android/before-plugins.gradle
? You are talking about a NativeScript project, yes?
Rather than adding classpath to platforms/android/build.gradle a better method is to create a file named App_Resources/Android/buildscript.gradle
with the content below:
repositories {
google()
jcenter()
}
dependencies {
classpath "com.google.gms:google-services:4.3.4"
}
this way, the gms configuration will be included at the initialization of the build process. Make sure to clean the project and start over.
from nativescript-plugin-firebase.
@tylerablake Hi I had the same problem
You have to had this in Manifest (I think its because the script when insert this code in the Manifest does't put the exported)
<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>
PS - Sorry for my English but I'm Portuguese
from nativescript-plugin-firebase.
Thanks @tujlaky I already have that apply plugin in my app.gradle file. This is driving me crazy.
from nativescript-plugin-firebase.
@SingleMalted I've encountered this same problem but I'm confused by your description of the locations. I have a {N} 8.2 JS project, and I don't have (or can't find) a
platform/app/build.gradle
file. Would that beplatforms/android/build.gradle
? Nor do I seem to have what you describe as the rootbuild.gradle
- maybeApp_Resources/Android/app.gradle
or perhapsApp_resources/Android/before-plugins.gradle
? You are talking about a NativeScript project, yes?Rather than adding classpath to platforms/android/build.gradle a better method is to create a file named App_Resources/Android/buildscript.gradle
with the content below:
repositories { google() jcenter() } dependencies { classpath "com.google.gms:google-services:4.3.4" }
this way, the gms configuration will be included at the initialization of the build process. Make sure to clean the project and start over.
Hi @comporell, I followed your steps and added the content in buildscript.gradle >. I get some new error:
A problem occurred evaluating script.
Could not find method compile() for arguments [com.romandanylyk:pageindicatorview:1.0.3] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Seems the compile() function has been removed in gradle 7.0 and depracated before 4.10. Does anyone know how to specify the gradle version used? Or an idea for a fix for the problem above?
from nativescript-plugin-firebase.
Hello guys, I found the issue.
This patch seems to fix it: Just override your hooks/firebase-build-gradle.js
https://gist.github.com/gabrielbiga/aa4efb87704bc5238efdaa5a9d06fa1d
I will create a PR adding this modified hook to the code. Until then, please test it.
from nativescript-plugin-firebase.
For me the following line fixed the issue in the App_Resources/Android/app.gradle file:
// Add the following line:
apply plugin: 'com.google.gms.google-services' // Google Services plugin
android {
https://firebase.google.com/docs/android/setup#manually_add_firebase
from nativescript-plugin-firebase.
For me the following line fixed the issue in the App_Resources/Android/app.gradle file:
// Add the following line: apply plugin: 'com.google.gms.google-services' // Google Services plugin android {
https://firebase.google.com/docs/android/setup#manually_add_firebase
Sadly, this did not work for me. I am getting the same error mentioned above.
from nativescript-plugin-firebase.
I was able to fix my issue. The classpath com.google.gms:google-services
wasn't being copied over to the build.gradle
dependencies node.
from nativescript-plugin-firebase.
I am also having the same issue. @SingleMalted could you please provide more info, example of .gradle file with it's location?
from nativescript-plugin-firebase.
I made the following changes and managed to build. I hope this gets fixed in the future
in App_Resources\Android\app.gradle
(...)
android {
compileSdkVersion 31 // <-- This
defaultConfig {
(...)
in platforms\android\build.gradle
(...)
dependencies {
(...)
classpath "com.google.gms:google-services:4.3.4" // <-- This
}
(...)
from nativescript-plugin-firebase.
Thanks @SingleMalted and @comporell for the detailed explanation.
from nativescript-plugin-firebase.
I made the changes in platform/app/build.gradle and platform/build.gradle
but when I execute : ns debug android
I receive the error
`Gradle build...
assets by status 7.77 MiB [cached] 6 assets
Entrypoint bundle 7.4 MiB = runtime.js 86.4 KiB vendor.js 6.97 MiB bundle.js 360 KiB
cached modules 2.77 MiB (javascript) 24.8 KiB (runtime) [cached] 351 modules
webpack 5.70.0 compiled successfully in 176 ms
Webpack compilation complete. Watching for file changes.
+ applying user-defined configuration from /Users/pedromartins/Develop/web/www/prociv/example-app/App_Resources/Android/before-plugins.gradle
+ setting applicationId
+ applying user-defined configuration from /Users/pedromartins/Develop/web/www/prociv/example-app/App_Resources/Android/before-plugins.gradle
+ applying user-defined configuration from /Users/pedromartins/Develop/web/www/prociv/example-app/App_Resources/Android/app.gradle
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: /Users/pedromartins/Develop/web/www/prociv/example-app/node_modules/@nativescript/core/platforms/android/core.aar
+ adding aar plugin dependency: /Users/pedromartins/Develop/web/www/prociv/example-app/node_modules/@nativescript/core/platforms/android/widgets-release.aar
+ adding aar plugin dependency: /Users/pedromartins/Develop/web/www/prociv/example-app/node_modules/@nativescript/firebase/platforms/android/firebase.aar
+ adding aar plugin dependency: /Users/pedromartins/Develop/web/www/prociv/example-app/node_modules/@nativescript/firebase/platforms/android/firebase-release.aar
Execution failed for task ':app:processDebugGoogleServices'.
No matching client found for package name 'org.nativescript.exampleapp'
Unable to apply changes on device: emulator-5554. Error is: Command ./gradlew failed with exit code 1.`
Can anybody help me
Thanks
from nativescript-plugin-firebase.
@pmiguelmartins Do you have the google-service.json
file in that directory?
https://developers.google.com/android/guides/google-services-plugin
from nativescript-plugin-firebase.
@SingleMalted Thanks for the fast response
Yes I have .... this was working ...
But know gives this error
from nativescript-plugin-firebase.
from nativescript-plugin-firebase.
The apply plugin: 'com.google.gms.google-services'
needs to be called at the beginning of the platform/app/build.gradle
and the dependencies { classpath "com.google.gms:google-services:4.3.4"}
goes in the root build.gradle
.
from nativescript-plugin-firebase.
I create a new project and put the code where you mentioned
I still have the error
`
Gradle build...
assets by status 7.77 MiB [cached] 6 assets
Entrypoint bundle 7.4 MiB = runtime.js 86.4 KiB vendor.js 6.97 MiB bundle.js 360 KiB
cached modules 2.77 MiB (javascript) 24.8 KiB (runtime) [cached] 351 modules
webpack 5.70.0 compiled successfully in 233 ms
Webpack compilation complete. Watching for file changes.
+ applying user-defined configuration from /Users/pedromartins/Develop/web/www/prociv/example-app/App_Resources/Android/before-plugins.gradle
+ setting applicationId
+ applying user-defined configuration from /Users/pedromartins/Develop/web/www/prociv/example-app/App_Resources/Android/before-plugins.gradle
+ applying user-defined configuration from /Users/pedromartins/Develop/web/www/prociv/example-app/App_Resources/Android/app.gradle
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: /Users/pedromartins/Develop/web/www/prociv/example-app/node_modules/@nativescript/core/platforms/android/core.aar
+ adding aar plugin dependency: /Users/pedromartins/Develop/web/www/prociv/example-app/node_modules/@nativescript/core/platforms/android/widgets-release.aar
+ adding aar plugin dependency: /Users/pedromartins/Develop/web/www/prociv/example-app/node_modules/@nativescript/firebase/platforms/android/firebase.aar
+ adding aar plugin dependency: /Users/pedromartins/Develop/web/www/prociv/example-app/node_modules/@nativescript/firebase/platforms/android/firebase-release.aar
Execution failed for task ':app:processDebugGoogleServices'.
No matching client found for package name 'org.nativescript.exampleapp'
`
from nativescript-plugin-firebase.
Excuse me for asking again but you are downloading your google-service.json
file from your firebase
account correct?
from nativescript-plugin-firebase.
@SingleMalted yes
And download again to compare but is iqual
from nativescript-plugin-firebase.
@pmiguelmartins do you have any hook scripts that might be overwriting the gradle.build
? It took me a bit of work to get my project working but the best thing I can do at this point is just send you this https://developers.google.com/android/guides/google-services-plugin
run ns doctor
and send the results. Also what version of Node/NPM are you using?
from nativescript-plugin-firebase.
my ns doctor :
`
~/Develop/web/www/prociv/example-app master !5 ?3 ❯ ns doctor ✘ INT 45m 54s 20:35:02
✔ Getting environment information
No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 13.2.1 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.2.2 version and is up to date.
✔ Component @nativescript/core has 8.2.1 version and is up to date.
✖ Component @nativescript/ios is not installed.
✔ Component @nativescript/android has 8.2.2 version and is up to date.
`
node version : v16.14.1
I created a new app ( ns create example-app --vue )
and make the changes but the error keeps ...
from nativescript-plugin-firebase.
Oh didn't realize you are using vue, not that it should really matter but I'm using TS/Vanilla JS.
I don't think the node version v16.14.1
is supported however.
I'm running on node v14.15.0
from nativescript-plugin-firebase.
@SingleMalted I've encountered this same problem but I'm confused by your description of the locations. I have a {N} 8.2 JS project, and I don't have (or can't find) a platform/app/build.gradle
file. Would that be platforms/android/build.gradle
? Nor do I seem to have what you describe as the root build.gradle
- maybe App_Resources/Android/app.gradle
or perhaps App_resources/Android/before-plugins.gradle
? You are talking about a NativeScript project, yes?
from nativescript-plugin-firebase.
I create a new project make the changes and now the error is :
/Users/pedromartins/Develop/web/www/prociv/example-app/platforms/android/app/src/main/AndroidManifest.xml:13:9-17:19 Error: android:exported needs to be explicitly specified for element <service#org.nativescript.plugins.firebase.MyFirebaseMessagingService>. Apps targeting Android 12 and higher are required to specify an explicit value for
android:exportedwhen the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. /Users/pedromartins/Develop/web/www/prociv/example-app/platforms/android/app/src/main/AndroidManifest.xml:18:9-22:19 Error: android:exported needs to be explicitly specified for element <service#org.nativescript.plugins.firebase.MyFirebaseInstanceIDService>. Apps targeting Android 12 and higher are required to specify an explicit value for
android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
Execution failed for task ':app:processDebugMainManifest'.
Manifest merger failed with multiple errors, see logs
`
from nativescript-plugin-firebase.
I'm sure your structure is different than mine since I'm building in vanilla js. I have hook scripts that write to a couple build.gradles.
I would suggest jumping on the NS discord channel and asking someone who is currently using vue.
from nativescript-plugin-firebase.
@pmiguelmartins you're getting closer.
Your android manifest needs an exported="true || false" for every activity.
You also need to add your firebase services. Bare with me I'm on the beach on my phone 😆 I'll get you that code in a few min.
from nativescript-plugin-firebase.
@SingleMalted Thanks very much
And enjoy the beach ... I'm from Portugal / Algarve ... I know what is beach time !!!!
from nativescript-plugin-firebase.
@SingleMalted Thanks very much
And enjoy the beach ... I'm from Portugal / Algarve ... I know what is beach time !!!!
You need to add a service for every firebase component you're using... like so
<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>
from nativescript-plugin-firebase.
I create a new project make the changes and now the error is :
/Users/pedromartins/Develop/web/www/prociv/example-app/platforms/android/app/src/main/AndroidManifest.xml:13:9-17:19 Error: android:exported needs to be explicitly specified for element <service#org.nativescript.plugins.firebase.MyFirebaseMessagingService>. Apps targeting Android 12 and higher are required to specify an explicit value for
android:exportedwhen the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. /Users/pedromartins/Develop/web/www/prociv/example-app/platforms/android/app/src/main/AndroidManifest.xml:18:9-22:19 Error: android:exported needs to be explicitly specified for element <service#org.nativescript.plugins.firebase.MyFirebaseInstanceIDService>. Apps targeting Android 12 and higher are required to specify an explicit value for
android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.Execution failed for task ':app:processDebugMainManifest'. Manifest merger failed with multiple errors, see logs `
As @SingleMalted mentioned, add exported = "true" flag to you activity in App_Resources\Android\src\main\AndroidManifest.xml
(...)
<activity
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
android:theme="@style/LaunchScreenTheme"
android:hardwareAccelerated="true"
android:exported="true"
android:launchMode="singleTask">
(...)
from nativescript-plugin-firebase.
@comporell I added the buildscript.gradle
file you suggested as well as having android:exported="true"
set in the AndroidManifest but I'm receiving this error:
Unable to create service org.nativescript.plugins.firebase.MyFirebaseMessagingService: java.lang.ClassNotFoundException: Didn't find class "org.nativescript.plugins.firebase.MyFirebaseMessagingService" on path: DexPathList
Any ideas?
from nativescript-plugin-firebase.
Any ideas?
Do you have multiDexEnabled true
in App_Resources/Android/app.gradle?
from nativescript-plugin-firebase.
Any ideas?
Do you have
multiDexEnabled true
in App_Resources/Android/app.gradle?
Yeah I do
from nativescript-plugin-firebase.
@pmiguelmartins Thanks for helping out! Yes, I have android:exported="false"
for those.
from nativescript-plugin-firebase.
@gabrielbiga After replacing firebase-build-gradle.js I am got below error:
Plugin with id 'io.fabric' not found.```
Do you have any idea suggestion to resolve this issue ?
from nativescript-plugin-firebase.
I've tried everything described here but unfortunately nothing works.
Urgent response and error correction is needed!
from nativescript-plugin-firebase.
Hello guys, I found the issue. This patch seems to fix it: Just override your hooks/firebase-build-gradle.js
https://gist.github.com/gabrielbiga/aa4efb87704bc5238efdaa5a9d06fa1d
I will create a PR adding this modified hook to the code. Until then, please test it.
Thank You so much. Works fine for me!
from nativescript-plugin-firebase.
Your
platform/app/build.gradle
needs to haveapply plugin: "com.google.gms.google-services"
and yourplatform/build.gradle
needs to containdependencies { classpath "com.google.gms:google-services:4.3.4"}
I use an
after-prepare
hook script to write these two lines to their respective files. This is necessary for me as I use CI/CD for my builds. If you don't use a CI/CD you can manually update the build files with the lines above.
Thanks, @SingleMalted. This worked for me.
I also need an after prepare
hook script, but I don't know how to create it. Could you add some basic information or guidance on how to create one?
Thanks in advance.
from nativescript-plugin-firebase.
Hello,
any news about the fix? unfortunately we have an old NS6 project ... is there some chance that a fix will be released also for the NS6 version ...
Thanks
Marco
from nativescript-plugin-firebase.
@EddyVerbruggen we have the same problem with NS6, do you have any suggestions? Thanks
from nativescript-plugin-firebase.
Solved for me.
Thank you very much
from nativescript-plugin-firebase.
Related Issues (20)
- M1 Issue - FirebaseSDK HOT 4
- Several "session_start" event are created on iOS 15 HOT 1
- ERROR TypeError: firebase.init is not a function.
- AdMob error: TypeError: Cannot set property 'resolve' of undefined
- Class constructor ContentView cannot be invoked without 'new'
- A problem occurred configuring root project 'firebase'.
- microsoft login
- Android 12 background notification led to crash (PendingIntent) HOT 6
- Unable to run new deployment HOT 1
- ion
- Error trying to install @nativescript/firebase
- barcode scanning issue - iPhone 13 Pro and iPhone 13 Pro max
- Cannot read property 'ads' of undefined on NativeScript 8.2.3 HOT 1
- Plugin with id 'com.google.gms.google-services' not found. HOT 13
- SetValue of type Date Error on iOS
- Barcode Scanning issue on native script 8 with native camera control
- Mark this repository as deprecated HOT 1
- Firebase Authentication functions are giving error "No reference found.
- Firebase Messaging crash issue in Android 13 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-plugin-firebase.