nxext / nx-extensions-ionic

Nx Extension for Ionic
MIT License
33 stars 9 forks source link

Ionic-Angular: Plugins is not installed error #39

Closed Flaviu989 closed 4 months ago

Flaviu989 commented 4 months ago

Describe the bug After installing Clipboard plugin from Awesome Cordova Plugins, I encountered an error when trying to use the plugin on an APK I created to test the app on my phone. I ran a debug session from my phone using Android Studio, and the logs indicated that the plugin is not installed. logcat  2024-06-28 170213

To Reproduce Steps to reproduce the behavior:

  1. Create Ionic-Angular app in a Nx project with @nxext/ionic-angular
  2. Install Clipboard plugin npm install @awesome-cordova-plugins/clipboard and create a simple copy method
    async copyToClipboard(text: string) {
    await this.clipboard.copy;
    }
  3. Built project nx run app-name:build:production
  4. Add Android nx run app-name:add:android
  5. Sync app: nx run app-name:sync:android
  6. Open in android studion: nx run app-name:open:android
  7. I also ran npx cordova plugin add cordova-clipboard as per error message
  8. Build and APK and install it on the phone

Expected behavior Expected plugin to work when running on a real device.

Additional context I don't have much experience with Ionic so if I forgot something please point me in the right way. Other plugins I installed from Awesome Cordova Plugins have the same "not installed" error showing. package.json for the app:

{
  "name": "app-name"
  "devDependencies": {
    "@capacitor/android": "file:../../node_modules/@capacitor/android",
    "@capacitor/cli": "file:../../node_modules/@capacitor/cli",
    "@capacitor/ios": "file:../../node_modules/@capacitor/ios",
    "@capacitor/assets": "file:../../node_moduels/@capacitor/assets"
  },
  "dependencies": {
    "@awesome-cordova-plugins/app-version": "file:../../node_modules/@awesome-cordova-plugins/app-version",
    "@awesome-cordova-plugins/clipboard": "file:../../node_modules/@awesome-cordova-plugins/clipboard",
    "@awesome-cordova-plugins/core": "file:../../node_modules/@awesome-cordova-plugins/core",
    "@awesome-cordova-plugins/device": "file:../../node_modules/@awesome-cordova-plugins/device",
    "@awesome-cordova-plugins/mobile-accessibility": "file:../../node_modules/@awesome-cordova-plugins/mobile-accessibility",
    "@capacitor/core": "file:../../node_modules/@capacitor/core",
    "@capacitor/haptics": "file:../../node_modules/@capacitor/haptics",
    "@capacitor/keyboard": "file:../../node_modules/@capacitor/keyboard",
    "@capacitor/status-bar": "file:../../node_modules/@capacitor/status-bar",
    "ionicons": "file:../../node_modules/ionicons"
}
Flaviu989 commented 4 months ago

I found the problem, according to capacitor documentation instead of npx cordova plugin add cordova-clipboard I had to use npm i cordova-clipboard and then run npx cap sync