Skip to content
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

Error trying to uninstall plugin #63

Closed
sagrawal31 opened this issue Jul 26, 2019 · 4 comments
Closed

Error trying to uninstall plugin #63

sagrawal31 opened this issue Jul 26, 2019 · 4 comments
Labels
bug Something isn't working properly

Comments

@sagrawal31
Copy link
Collaborator

Copied from wizpanda#42

Describe the bug

I had installed version 5 of the plugin but I'm using Cordova Android 8.0.
Trying to remove the plugin gave me an error.
I thought I had installed version 4, but I get the same error.

cordova plugin remove cordova-plugin-firebase-lib --save
cordova-android-support-gradle-release: removed Gradle config file: platforms/android/app/cordova-android-support-gradle-release/properties.gradle
cordova-android-support-gradle-release: removed Gradle config file: platforms/android/app/src/main/cordova-android-support-gradle-release/properties.gradle
Uninstalling cordova-plugin-firebase-lib from android
Error during processing of action! Attempting to revert...
(node:7346) UnhandledPromiseRejectionWarning: Error: Uh oh!
ENOENT: no such file or directory, open '/home/dev/Ionic-app/apps/newapp/platforms/android/app/src/main/AndroidManifest.xml'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.parseElementtreeSync (/home/dev/Ionic-app/apps/node_modules/cordova-common/src/util/xml-helpers.js:181:36)
at new AndroidManifest (/home/dev/Ionic-app/apps/newapp/platforms/android/cordova/lib/AndroidManifest.js:29:20)
at AndroidProject.getPackageName (/home/dev/Ionic-app/apps/newapp/platforms/android/cordova/lib/AndroidProject.js:92:12)
at AndroidProject.getCustomSubprojectRelativeDir (/home/dev/Ionic-app/apps/newapp/platforms/android/cordova/lib/AndroidProject.js:98:28)
at uninstall (/home/dev/Ionic-app/apps/newapp/platforms/android/cordova/lib/pluginHandlers.js:104:46)
at ActionStack.process (/home/dev/Ionic-app/apps/node_modules/cordova-common/src/ActionStack.js:56:25)
at PluginManager.doOperation (/home/dev/Ionic-app/apps/node_modules/cordova-common/src/PluginManager.js:114:20)
at PluginManager.removePlugin (/home/dev/Ionic-app/apps/node_modules/cordova-common/src/PluginManager.js:148:17)
(node:7346) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7346) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

To Reproduce

Set up an ionic app with Cordova 8.0 (just updated to it). Ionic 3.20.1 and new Android 8.0.0 (updated).
Install the cordova-pligin-firebase-lib and remove it.
causes error.

Expected behavior

Not delete the AndroidManafest.xml file when removing the plugin.

Plugin version

I installed the latest and got the error that I was using the wrong version.
Tried to uninstall got the error above. Tried to manually remove any trace and install version 4.
Config.xml had this version.

Cleared plugin folder, removed and added android 8.0 to let it installed the plugins.
But it installed 5.1 again.
Config.xml yes 4.1.0

plugin list says
cordova-plugin-firebase-lib 5.1.1 "Google Firebase Plugin"

Desktop (please complete the following information):

Windows 10
Chrome 72

Smartphone (please complete the following information):

NA

Additional context

The real problem I'm having is getting Google Analytics to show data. Trying to get the versions correct.

sagrawal31 added a commit that referenced this issue Jul 26, 2019
@heidji
Copy link

heidji commented Jul 27, 2019

Google Analytics will be discontinued for mobile afaik in a couple of months. Why not use Firebase instead?

@Lucab95
Copy link

Lucab95 commented Jul 29, 2019

I had the same problem and solved like the migration from cordova-plugin-firebase to cordova-plugin-firebasex. As follows:

rm -Rf platforms/android
cordova plugin rm cordova-plugin-firebasex 
rm -Rf plugins/ node_modules/
npm install
cordova plugin add cordova-plugin-firebasex 
cordova platform add android

In this way, you can do a safe removal of the previous version and reinstall the updated one.
I hope it helps.

@testanddeploy
Copy link

same problem

@dpa99c
Copy link
Owner

dpa99c commented Aug 6, 2019

I've done some investigation and determined the cause of the problem when uninstalling the plugin to be this line in the config.xml:

<resource-file src="src/android/google-services.json" target="."/>

This causes an error in the cordova-android platform scripts when the plugin is uninstalled.
Removing it resolves the uninstall issue.

Since the bundled google-services.json is merely a placeholder (as is GoogleService-Info.plist) that is replaced with your real Firebase project config, I have simply removed it from the plugin.

@dpa99c dpa99c added the bug Something isn't working properly label Aug 6, 2019
@dpa99c dpa99c closed this as completed in a9c6674 Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly
Projects
None yet
Development

No branches or pull requests

5 participants