Reputation: 43
I am building an Ionic app and I'd like to use the plugin firebasex
.
Unfortunately, when running Ionic cordova build/run android, I am getting the following error:
Cannot find module 'C:\[...]\platforms\android\cordova\lib\AndroidStudio'
I have tried everything: remove and add back the platform, cleaning caches, re installing modules via npm install
...
Here's my environnement:
Ionic:
Ionic CLI : 5.2.3
Utility:
cordova-res : not installed
native-run : 0.2.8
System:
NodeJS : v10.15.3
npm : 6.4.1
OS : Windows 10
I just want the app to build and deploy.
Upvotes: 0
Views: 2173
Reputation: 43
Found the solution:
Create file \platforms\android\cordova\lib\AndroidStudio.js
/*
* This is a simple routine that checks if project is an Android Studio Project
*
* @param {String} root Root folder of the project
*/
/* jshint esnext: false */
var path = require('path');
var fs = require('fs');
var CordovaError = require('cordova-common').CordovaError;
module.exports.isAndroidStudioProject = function isAndroidStudioProject (root) {
var eclipseFiles = ['AndroidManifest.xml', 'libs', 'res'];
var androidStudioFiles = ['app', 'app/src/main'];
// assume it is an AS project and not an Eclipse project
var isEclipse = false;
var isAS = true;
if (!fs.existsSync(root)) {
throw new CordovaError('AndroidStudio.js:inAndroidStudioProject root does not exist: ' + root);
}
// if any of the following exists, then we are not an ASProj
eclipseFiles.forEach(function (file) {
if (fs.existsSync(path.join(root, file))) {
isEclipse = true;
}
});
// if it is NOT an eclipse project, check that all required files exist
if (!isEclipse) {
androidStudioFiles.forEach(function (file) {
if (!fs.existsSync(path.join(root, file))) {
console.log('missing file :: ' + file);
isAS = false;
}
});
}
return (!isEclipse && isAS);
};
Upvotes: 2
Reputation: 736
Can you try the flowing,
echo $ANDROID_HOME
source ~/.bash_profile
or source ~/.bashrc
I hope these are helps you
Upvotes: 0
Reputation: 788
Can you do the following steps:
cordova clean android (or IOS)
rm -rf node_modules
npm install
cordova build android
Check out this source on github:
https://github.com/ionic-team/ionic-cli/issues/3301
Hope this helps for you
Upvotes: 0