Updating my Cordova plugin collection

My Cordova plugin for Android applications differs from others as it only utilizes an Application (App.java) and not a CordovaPlugin class.

Upon initial installation using cordova plugin add, everything functions correctly. However, when attempting to remove it with cordova plugin rm, the folder remains in node_modules and the plugin dependency name persists in package.json. Additionally, some code is deleted from the manifest that belongs to another plugin, likely due to an error in the plugin.xml file. This causes issues if trying to reinstall the plugin without updating the version.

Below is the content of my plugin.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="com.test.plugin.applicationTest" version="1.0.0" platform = "Android">
   <name>codova-app-plugin</name>
   <description>Test</description>
   <author>test</author>

   <license>Apache 2.0</license>

   <keywords>cordova, application</keywords>


   <platform name="android">
      <config-file parent="/*" target="res/xml/config.xml">
         <feature name="applicationTest">
            <param name="android-package" value="com.test.plugin.applicationTest" />
         </feature>
      </config-file>

      <source-file src="src/android/App.java" target-dir="src/com/test/plugin/applicationTest" />      

       <config-file target="AndroidManifest.xml" parent="/*">
         <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
       </config-file>

      <edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
         <application android:name="com.test.plugin.applicationTest.App"/>
      </edit-config>

   </platform>
</plugin>

How can I ensure that the node_modules are removed properly, and prevent the deletion of crucial tags in the AndroidManifest?

Edit: Removing the edit-config section and implementing hooks instead prevents the deletion of AndroidManifest tags but raises issues such as the hooks not executing or EACCES errors. Moreover, the node_modules dependencies persist.

   <hook type="after_plugin_install" src="scripts/nameManifest.js" /> -- won't execute
   <hook type="before_plugin_uninstall" src="scripts/uninstallPackage.sh" /> -- EACCESS error

Answer №1

At this moment, my suggestion is to eliminate the edit-config and establish hooks for modifying the application name and running npm uninstall

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for installing npm packages using a python script in the same directory as my script

The desired file structure should resemble this: test.py node_modules (Folder containing installed npm modules) Here is the attempted solution: import subprocess import os dir_path = os.path.dirname(os.path.realpath(__file__)) # Retrieve the directory ...

A guide on executing Python scripts and using CMD within a Dockerfile to manage a Docker container

In my current scenario, I have an image that is using a customized Dockerfile. Upon starting the container, I am aiming to execute CMD ["npm", "start"]. However, prior to that command execution, there are three different scripts that need to run. I attemp ...

The file "tfjs_binding.node" could not be located in the directory where @tensorflow is installed

After attempting to utilize certain functionalities of TensorFlow, I encountered an error indicating that "tfjs_binding.node" was not found in the @tensorflow installation folder. I made sure to install Python 2.7 as a prerequisite for TensorFlow and veri ...

Issue arises when attempting to run npm start on Windows 10 due to node-gyp failing

After setting up Node.js version 12.18.1 and Python v3.8.1 on my Windows 10 system, I encountered an issue when trying to run npm install in a project: gyp ERR! configure error gyp ERR! stack Error: Command failed: C:\Program Files (x86)\Python&b ...

An error of 'Address already being used' encountered while utilizing cookiecutter-flask

My operating system is OS X 10.14.3 and I am attempting to utilize the impressive cookiecutter-flask project. I have diligently followed the instructions provided in the README.rst: cookiecutter https://github.com/sloria/cookiecutter-flask.git # My test p ...

I am encountering the issue where Prisma client python consistently notifies me that my client has not been generated, despite the fact that I have already executed the necessary

After setting up Prisma Client Python and SQLite to create a database for my program successfully, I encountered an issue when trying to run my program. Despite ensuring that everything was installed correctly and running commands like "prisma generate" an ...

Having trouble installing an npm package with your Python script?

Here is the Python code I am struggling with: import subprocess subprocess.Popen(["npm", "install", "express"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) Unfortunately, this code isn't working as exp ...

Using a separate iteration of Python while conducting an NPM installation

I have admin privileges on a VPS running CentOS 5.9 with Python 2.4.3 installed by default. I decided to upgrade to Python 2.7.3 using the commands below (I opted for make altinstall instead of make install): wget http://www.python.org/ftp/python/2.7.3/Py ...

There is a compilation error occurring in the Kivy build.py script

After setting up the Kivy development environment on my Ubuntu 13.10 virtual machine, including cloning Kivy, building a distribution with distribute.sh, and using the build.py script to create an APK file for my project, I encountered an error during the ...

What is the best technique for scrolling multiple times to locate a specific element?

I am trying to develop a script that will continuously scroll until it finds the specific element using: from appium.webdriver.common.touch_action import TouchAction The webpage in question is an Events page featuring various game titles. Currently, I ha ...

An error occurred: gyp ERR! stack - The command `python -c import sys; print "%s.%s.%s" % sys.version_info[:3]` has failed

While attempting to npm install in a Vue project, I encountered an error even after running vue create (name): npm ERR! gyp verb check python checking for Python executable "c:\Python310\python.exe" in the PATH npm ERR! gyp verb `which` ...

The multi-phase Docker build process fails to transfer files generated in the preceding stage

I am facing an issue with my Django app's Docker build, which consists of two stages: The first stage uses a Node image to compile static assets using Gulp. This stage creates the node_modules directory and a folder named build. The second stage is s ...

What serves as the pip counterpart to package.json?

While I am familiar with the requirements.txt file, it only lists dependencies. However, I'm interested in other metadata such as package name, author, and main function. Is there a standard format for this information? I've heard of the setup.p ...

A guide on removing text from a text field with MonkeyRunner API in a Python script

I've been attempting to remove text from a text field using the monkeyrunner API and writing a script in Python. There are key events such as "KEYCODE_FORWARD_DEL", "KEYCODE_DEL" to delete text, and "KEYCODE_MOVE_END" to move the cursor to the end. ...