-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing the plugin DELETES almost everything from the Android platform #898
Comments
@ragcsalo Please follow the bug template when opening an issue so we can get the necessary information to better try to assist you. What version of the plugin are you using? |
Describe the bug To Reproduce $ cordova create plugtestapp com.test.plugtestapp PlugTestApp \
&& cd plugtestapp/ \
&& cordova plugin add cordova-plugin-firebase \
&& cordova platform add android \
&& cordova plugin remove cordova-plugin-firebase All android platform folder is messed up, especially Expected behavior Console Logs
Plugin Version $ node -v
v8.11.1
$ npm -v
6.1.0
$ cordova -v
8.1.2 (cordova-lib@8.1.1)
$ cordova plugin list
cordova-plugin-firebase 2.0.5 "Google Firebase Plugin"
cordova-plugin-whitelist 1.3.3 "Whitelist" Desktop (please complete the following information):
Additional context |
Any insight/news on this one? |
@Jule- I believe this is happening with the after_prepare script. When we modified it and did the same with in the install phase I believe it fixed the problem but caused other breakages. The script simply copies Google files over, it does not touch the Manifest. I'm wondering if there is a file locking problem with Cordova in this phase. Since no one works on this plugin full time, it's completely maintained by community contributions. If you could take a look at that script and confirm that is the issue along with determining which part of the script is causing the issue, that would be a large help in resolving the issue. |
Indeed I looked into the (un)install plugin files and I see that you manage to write in the project The right way is to write a side And this is exactly what is done here: cordova-plugin-firebase/plugin.xml Lines 57 to 62 in 98953f4
I did not really know why hooks are trying to write inside root project Plus I don't think we should use both Now the real issue is not there, in fact the issue is there: cordova-plugin-firebase/plugin.xml Line 47 in 98953f4
Should be written: <resource-file src="src/android/google-services.json" target="app/google-services.json"/>
------------------------ On uninstall it try and succeed to remove I'll make a PR with these modifications but I need people in order to confirm that nothing is broken. |
@Jule-, thanks for taking the time to look at the scripts! That is more than most people do. I would agree with you that modifying build.gradle is not optimal. That being said, I don't think you understand the difference between the two different build.gradle files. The one at the root (modified by the install process) is actually defines the dependencies and sources for the gradle instance that builds/runs the build.gradle in the app directory. Firebase requires a plugin to be run as part of the build process, please see the Firebase Install Guide. Hence, the plugin and it's dependencies are required to be added to the root build.gradle file so they are available during the build process. Due to this requirement, both files HAVE to be modified. Since Cordova does not provide a mechanism to modify the root build.gradle, this is the only option (definitely open to other options if you know of other ways). Since the two files serve difference purposes, there is no way to consolidate dependencies. As for the main issue, I have found that resource file entry to be misleading. The google-services.json specifies details about your Firebase account. If you look at the file in the plugin, you will find it contains dummy information (at least I hope no one has project number 123). Best I can guess is that the file was copied over to prevent build errors. The meaningful copy comes in the after_prepare when the google-services.json is copied from the project directory, not the plugin directory. This allows consumers of this plugin to simply save their goggle-services.json in their project instead of requiring everyone to maintain their own fork. If you remove the after_prepare without some how copying the google-services.json file, you will be able to build and I believe run your project but nothing will be reported back to your firebase account, nor will you be able to use push notifications. Hence, this step is an important one. If you have suggestions on how we might approach the problem differently, I would love to hear them. I truly believe there is an obscure bug in Cordova as we never touch the Manifest file via custom scripts but some how it is removed. |
Ho well! I should have look more carefully. 1/ Ok for the
If someone have some clue on this Class apply in gradle file maybe we could do the same for 2/ Ok I didn't see that coming! Of course the plugin can't add my
3/ The good news is that unless I missed some stuff on my side thoughts... 🙃 I have really spotted the issue! Which is definitely this line that should be safely removed! cordova-plugin-firebase/plugin.xml Line 47 in 98953f4
It really causes what I said: on uninstall cordova try to remove all inside I am making a PR. |
Ok I've finished my PR which not passes tests due to global Please @briantq, can you take a look at this? |
like WTH? I can't uninstall this plugin. Is there any manual fix that I can apply? |
@BumbleeLin Remove the platform, remove the plugin, and install the platform again |
As I have suggested here on the 3rd point: #898 (comment) Or follow @ruano84 suggestion since this will obviously work as intended. |
And maybe for a permanent fix you could upvote my pull request which is still in pending state... 😞 |
THANKS, this is the real solution!!! :-) |
@ragcsalo I am happy that worked for you too! Hope my PR will be merged some day... |
PR still not merged after 2 years.... :-( |
CLI command: cordova plugin remove cordova-plugin-firebase
Output:
Result: Almost EVERYTHING is deleted from platforms/android/app/src directory!!!!!!!!
PLEASE try to remove this Firebase plugin from your Android Studio project via CLI, and see what happens... it is a NIGHTMARE!!!!!!
Originally posted by @ragcsalo in #618 (comment)
The text was updated successfully, but these errors were encountered: