[ERROR] Cordova is not supported for react projects

Hello everyone, I’m trying a Ionic + React project and when I try to use any ionic cordova command, i get the following error:

[ERROR] Cordova is not supported for react projects

Any ideas how I can solve this?

Still got no luck with this one… does someone have had the same issue as me?

I have the same problem, I’m on Mac.

use capacitor it should give you similar results

1 Like

Well, since that React now is officially supported by Ionic, this looks like a bit more serious now. Is there a way to fix this?

Capacitor can use a lot of Cordova plugins on Android and iOS (main problem is browser which Capacitor doesn’t support). You can try it if you want.

consider using the cordova command without ionic in front. After all, you have cordova installed globally.

Ionic CLI just adds a bit of sugar, but the basic functionality of cordova is not affected

Cordova and React should work together irrespective of the ionic cli

So:
cordova build android

instead of ionic cordova build android

This is what happens when I run the commands with cordova instead:

% cordova platform add android
Current working directory is not a Cordova-based project.

Maybe u need to build the www assets?

Quick google search (check the last few posts about what makes a project a cordova project)

All the solutions given in the post doesn’t work…

i am using the browser in a vue capacitor project now… not sure what you are doing differently?

Google search on react and cordova

So…

Are you using Cordova plugins on the browser with Capacito?

I am building mobile apps for deployment on mobile devices, not websites or PWAs

If you try to use Cordova plugins using Capacitor as a PWA it won’t work. Capacitor only uses the Java and Swift code which what I was answering.

The Ionic React Overview page says "There are no plans to support a Cordova integration for Ionic React":

Capacitor is the official cross-platform app runtime used to make your Ionic React web app run natively on iOS, Android, Electron, and the web.

While there are no known technical limitations to using Ionic React with Cordova plugins, Capacitor is officially recommended. There are no plans to support a Cordova integration for Ionic React in the Ionic CLI tooling at this time. For more details, please see here.