Search code examples
androidionic-frameworkionic4ionic-react

Building ionic/react for android - Invalid project type "react"


I'm using @ionic/react in order to build an Android app. Everything worked fine, but I do not seem to be able to build an android version of it.

The commands

  • $ ionic build
  • $ ionic serve
  • $ ionic integrations enable capacitor
  • $ ionic cap add android
  • $ ionic cap open android

all give me the error message:

[ERROR] Invalid project type: react (project config: .\ionic.config.json).
    Project type must be one of: angular, ionic-angular, ionic1, custom

Do I interpret this correctly that @ionic/react is not yet full supported?

I am confused, thought I built an @ionic/react-app for android before.

Been following this documentation: https://ionicframework.com/docs/react/your-first-app

My ionic.config.json:

{
  "name": "Prototype",
  "integrations": {},
  "type": "react"
}

Important dependencies from package.json:

    "dependencies": {
        "@ionic/react": "^4.11.0",
        "@ionic/react-router": "^4.11.0",
        "@react-google-maps/api": "1.7.12",
        "@types/jest": "^24.0.18",
        "@types/node": "^12.7.12",
        "@types/react": "^16.9.5",
        "@types/react-dom": "^16.9.1",
        "@types/react-router": "^5.1.1",
        "@types/react-router-dom": "^5.1.0",
        "ionic": "4.12.0",
        "ionicons": "^4.6.3",
        "react": "^16.10.2",
        "react-dom": "^16.10.2",
        "react-router": "^5.1.0",
        "react-router-dom": "^5.1.0",
        "react-scripts": "3.2.0",
        "typescript": "3.6.3"
    },

Solution

  • I got the same issue, you have to update ionic to the latest version.

    npm uninstall -g @ionic/cli
    npm install -g @ionic/cli@latest