ReallySmallSoftware / cordova-plugin-firebase-crashlytics

Google Firebase Crashlytics Cordova plugin
Other
33 stars 80 forks source link

plugin name #1

Closed johanlantz closed 4 years ago

johanlantz commented 6 years ago

quick comment. In the description you have put plugin add cordova-plugin-firestore

I guess firestore is a copy paste error. It took me half a day to spot that problem since I had installed the wrong plugin.

Also I wondered if you have this successfully working. I only get an error message about API key being null which does not make much sense since it should not be needed afaik?

ReallySmallSoftware commented 6 years ago

First of all, thank you for your feedback. I'm sorry it caused you some wasted time.

I do have this working successfully, and I do remember getting the same error you are getting. I am currently in the process of writing a new test application so I can test my plugins more thoroughly, so I will add this one to it and see if I can recreate and resolve your issue.

I will post again when I know more.

johanlantz commented 6 years ago

No need to apologize, I appreciate you sharing your efforts here.

Please let me know if you find something. I also tried the cordova-firebase module and added crashlytics support to that one in gradle but I did not manage to get that approach to work either.

ReallySmallSoftware commented 6 years ago

OK, I think I understand the API key null issue. Can you try installing cordova-support-google-services if not already present? You can do what this plugin does manually but I found this removed some of the hassle.

Secondly, and rather embarrassingly, although I have tested and proven the crash() method works, it looks like I never wired up the logException() method in this release. I will address this very shortly!

johanlantz commented 6 years ago

I do have google-services installed. We use this plugin https://github.com/arnesson/cordova-plugin-firebase for all other Firebase things and it pulls the google-services as well. I updated the version to 3.1.2 since the Crashlytics doc says to use that but it still ended up with the same API key issue which is super weird. It looks easy on the surface but this issue drives me nuts

ReallySmallSoftware commented 6 years ago

I've removed the plugin I was using and tried the one you use and I must admit I had a lot of issues - probably me - but I had no end of problems - first with the issue you are seeing around the api key, and upon trying to address that issues with duplicates in strings.xml.

That aside, can you tell me if anywhere in your project the following appears in any build.gradle

apply plugin: 'com.google.gms.google-services'

The Crashlytics docs says this must appear at the end of the build.gradle. Even when I add it I see the other errors I mention above, but I just wondered if it was getting added automatically for you?

I do see it in the build-extras.gradle for cordova-plugin-firebase but I can't see that being applied anywhere.

johanlantz commented 6 years ago

sorry for the delay. The only reference I see in the build.gradle is the compile line: compile "com.google.gms:google-services:+"

I see that in build_extras.gradle for the firebase plugin it says: apply plugin: 'com.google.gms.google-services'

However under plugins I only see that it is importing the build.gradle not the extras file: apply from: "../cordova-plugin-firebase/xxxx-build.gradle" // PLUGIN GRADLE EXTENSIONS END

ReallySmallSoftware commented 6 years ago

Yes, that's what I thought. From the Crashlytics documentation I do believe that "apply plugin: 'com.google.gms.google-services'" is critical to it working. My understanding is that it causes some autowiring underneath.

My biggest mystery is why when I add it manually with the plugin you are using that it doesn't solve the problem! I will try and find some time to dig a bit deeper.

ReallySmallSoftware commented 6 years ago

OK, I have released a new version of this plugin - although it really only fixes an incorrect dependency in the plugin configuration and updates the Crashlytics dependency versions.

However, I was also able to get my test app to build without either cordova-support-google-services or cordova-plugin-firebase. I simply made sure my build.gradle had the compile "com.google.gms:google-services:3.1.1" at the top and apply plugin: 'com.google.gms.google-services' as the very last line.

I appreciate this doesn't fix your problem, but I believe that maybe by having the apply plugin: 'com.google.gms.google-services' in the build.gradle might be conflicting with what cordova-plugin-firebase is doing. I find that adding cordova-plugin-firebase causes the build to fail because of the '+' style dependencies in that plugin. eg com.google.firebase:firebase-crash:+ rather than com.google.firebase:firebase-crash:11.8.0

I suspect that it might also be adding some values in string.xml which adding apply plugin: 'com.google.gms.google-services' also does.

I'm not criticising cordova-plugin-firebase btw, I'm just reporting what I'm seeing. I appreciate you have successfully used that plugin previously.

johanlantz commented 6 years ago

thanks so much for your efforts. I still can not make it work together with the other plugin that we do need for other features. As you say, it is possible that its due to the + style deps. I did manage to get a bit further by hardcoding the Firebase version but then I ran into other problems about duplicate keys in the json config etc so yeah, it is possible the other plugin adds more conflicting stuff. It seems hard to modify that plugin to make it work. Hopefully the author will update it or maybe another more complete Firebase plugin will pop up. It would be nice to have a single one plugin encapsulating all Firebase modules in a working way. Right now there are quite a few modules out there and making everytything work together between modules seems very challenging,

ReallySmallSoftware commented 6 years ago

I'm sorry I couldn't help get this working for you. I agree there are a lot of different modules! I personally favour a different module for each feature so they can be included in a modular fashion - but that does mean having them successfully interact together is troublesome, especially when they come from different authors.

P110 commented 6 years ago

Having the same problem - haven't got anything useful to contribute but just saying that I'm trying to get it all working, out of curiosity are you using Firebase 11.6.0 as it suggests in the installation? Just because I'm running 11.8.0, shouldn't cause any problems but, just a thought.

ReallySmallSoftware commented 6 years ago

I'm in the process of updating all the dependencies to 11.8.0 so that should be fine - I'm using that locally here without any problems. It was worth calling out though :-)

ReallySmallSoftware commented 4 years ago

Closing as not updated in a while and superseded by later changes