capacitor-community / admob

Community plugin for using Google AdMob
MIT License
205 stars 67 forks source link

Package com.getcapacitor.community.admob does not exist #179

Closed ckcckchk closed 1 year ago

ckcckchk commented 1 year ago

I am using ionic/angular(^5.8.3) + capacitor (^3.2.5) + nx monorepo. I added @capacitor-community/admob": "^3.3.0" to my project, following the implementation steps. When trying to run in Andriod emulator, got this error:

error: package com.getcapacitor.community.admob does not exist
( in android/app/src/main/java/**/**/MainActivity.java )

Because I am using NX, after $ npm i the admob pacakge, I did not run $ npx cap update. Instead, I ran $ nx run (PROJ-NAME):update.

Additional context My package.json

{
  "name": "nx-ionic",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "build": "nx build",
    "postinstall": "ngcc --properties es2015 browser module main",
    "start": "nx serve",
    "test": "nx test"
  },
  "private": true,
  "devDependencies": {
    "@angular-devkit/build-angular": "^12.0.0",
    "@angular-eslint/eslint-plugin": "~12.0.0",
    "@angular-eslint/eslint-plugin-template": "~12.0.0",
    "@angular-eslint/template-parser": "~12.0.0",
    "@angular/compiler-cli": "^12.0.0",
    "@angular/language-service": "^12.0.0",
    "@capacitor/android": "^3.2.5",
    "@capacitor/cli": "^3.2.5",
    "@capacitor/ios": "^3.2.5",
    "@nrwl/cli": "12.10.0",
    "@nrwl/cypress": "12.10.0",
    "@nrwl/eslint-plugin-nx": "12.10.0",
    "@nrwl/jest": "12.10.0",
    "@nrwl/linter": "12.10.0",
    "@nrwl/react": "^12.0.0",
    "@nrwl/tao": "12.10.0",
    "@nrwl/workspace": "12.10.0",
    "@nxtend/capacitor": "^12.0.0",
    "@nxtend/firebase": "^12.1.0",
    "@nxtend/ionic-angular": "^12.0.0",
    "@types/jest": "27.0.2",
    "@types/node": "14.14.33",
    "@typescript-eslint/eslint-plugin": "~4.31.1",
    "@typescript-eslint/parser": "~4.31.1",
    "cypress": "^8.3.0",
    "eslint": "7.22.0",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "jest": "27.2.3",
    "jest-preset-angular": "10.0.1",
    "prettier": "^2.3.1",
    "ts-jest": "27.0.5",
    "typescript": "~4.3.5"
  },
  "dependencies": {
    "@angular/animations": "^12.2.0",
    "@angular/common": "^12.2.0",
    "@angular/compiler": "^12.2.0",
    "@angular/core": "^12.2.0",
    "@angular/fire": "^6.1.5",
    "@angular/forms": "^12.2.0",
    "@angular/platform-browser": "^12.2.0",
    "@angular/platform-browser-dynamic": "^12.2.0",
    "@angular/router": "^12.2.0",
    "@capacitor-community/admob": "^3.3.0",
    "@capacitor/core": "^3.2.5",
    "@ionic/angular": "^5.8.3",
    "@ngx-translate/core": "^13.0.0",
    "@ngx-translate/http-loader": "^6.0.0",
    "@nrwl/angular": "^12.10.0",
    "@tinymce/tinymce-angular": "^4.2.4",
    "firebase": "^8.7.1",
    "moment": "^2.29.1",
    "rxjs": "~6.6.0",
    "tailwindcss": "^2.2.19",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.4"
  }
}
ckcckchk commented 1 year ago

It turns out that I should install the capacitor admob package within each project in nx monorepo, instead of installing in the the monorepo outermost level. Sorry, thank you.

distante commented 1 year ago

It turns out that I should install the capacitor admob package within each project in nx monorepo, instead of installing in the the monorepo outermost level. Sorry, thank you.

Sorry, late to the party but it is not needed that you install it in each project, it is enough for you to create a json file inside your project, with the list of the existing plugins.

Capacitor doesn't play completely well with nx monorepos