So I wanted to start a new ionic project by writing:
ionic start Ionic1 blank
After that I moved to that new directory and wanted to add android platform:
ionic platform add android
I then got this error:
Error: Failed to fetch platform android
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: EACCES: permission denied, open '/home/think/.cordova/lib/npm_cache/cordova-android/4.1.1/package/.npmignore'
I don't know why this happens. I tried these:
1) change the permision with
chmod 744 /home/think/.cordova/lib/npm_cache/cordova-android/4.1.1/package/.npmignore
2) uninstalled and installed nodejs, cordova, ionic, etc.
3) Executed with sudo ionic platform add android (but "sudo" is not necessary i think since I added android platform before in other projects without having to write "sudo" )
Still it's somehow not possible to add a platform.
I'm on ubuntu 14.04 LTS. I have android SDK manager installed.
I can build and run my other ionic projects that I created earlier. But since yesterday I can't build new projects anymore. It happened when I iupdated to ionic 1.7.13. I tried to downgrade ionic to an earlier version but that wouldn't solve the issue either.
Maybe this is a cache problem of cordova. Delete the cache and try to add the platform again:
rm -rf ~/.cordova
I have no idea what went wrong. i just installed cordova and ionic again and now it's working. For those who encountered the same problem: The commands I executed:
sudo npm install -g cordova
sudo npm install -g ionic
After that add, build, and run the project just as usual.
Try adding it with cordova instead of ionic.
cordova platform add android
Related
I am trying to add android platform to my existing ionic project. I am getting the below error.
Failed to restore plugin com.couchbase.lite.phonegap from config.xml. You might need to try adding it again.
Error:
Error: npm: Command failed with exit code 1 Error output:
I guess you tried on Android >= 7 which is needed for the couchbaselite plugin.
so you can downgrade to 6 :
ionic cordova platform rm android
ionic cordova platform add android#6
But if you need a recent android, you have to apply this Fixes : https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin/pull/110
remove manually node-modules and package-lock.json (imp*)
npm cache clean --force
finally run npm install
ionic cordova platform add android
I suggest you to remove the plugin and it's folder:
ionic cordova plugin remove couchbase-lite-phonegap-plugin
rm -rf plugins/com.couchbase.lite.phonegap/
Also, remove any line in package.json using the wrong folder name of com.couchbase.lite.phonegap, if you find any.
Then add your android platform as usual, then add the plugin back.
ionic cordova platform add android
ionic cordova plugin add couchbase-lite-phonegap-plugin
And if you still get any error, repeat the operation using the cordova --verbose directly, without ionic command. Example:
cordova plugin add couchbase-lite-phonegap-plugin --verbose
That command above should tell you exactly what went wrong.
Okay, so you run this. And it continues to fail.
cordova platform add android --save
And the output is this.
Error: Failed to fetch platform cordova-android#0.0.8
After trying to reinstall cordova, node, and other packages, I have had no luck. I am running this with the ionic blank starter package with ionic Cli 3.
For some reason with the latest version of everything, ionic, angular, the cli, etc, the platform was trying to add
cordova-android#0.0.8
To fix this, just go to this link and get the latest version, and run this...
sudo ionic cordova platform add android#6.4.0
I had the same issue and followed this link
https://github.com/apache/cordova-android/releases
There, I found that the latest version is 7.1.1
I tried this ionic cordova platform add android#7.1.1 but got the same error
From a forum I follow, I got this link https://www.npmjs.com/package/cordova-android
Then I tried this ionic cordova platform add android#7.1.0 and it ran as I expected
remove old android
ionic cordova platform rm android
add latest android
ionic cordova platform add android#latest
I just received an ionic v1 app that I have to make some changes,but after a fresh installation of ionic, I'm unable to run it. Every time that I run ionic run android in the ionic CLI, I receive this error:
WARN: ionic.project has been renamed to ionic.config.json, please
rename it. Using this version of Cordova with older version of
cordova-android is deprecated. Upgrade to cordova-android#5.0.0 or
newer.
Error: Your android platform does not have Api.js
For the moment I can not migrate to Ionic 2.
What can I do to run/build it?
Fist of all, when you install Ionic this way
npm install -g cordova ionic
You are getting the last CLI that works with Ionic 2, Angular 2 and a different project structure. If you want to run and build an Ionic v1 project you need the tools that works with your version.
To install a specific version you need to add # symbol after the name package and the version that you want for example:
npm install -g ionic#1.7.14
npm install -g cordova#6.0.0
Also you have to keep in mind that Android has been improving their tools too, and this version of cordova doesn't work properly with the latest Android tools chain. This question can help you to download and setup the android tools for this version of cordova.
After that you will be able to run ionic run android
I am no longer able to build my app and generate an apk anymore because an error shows up. Here is what happens when I try to build the app in the command prompt: Command Prompt
Can somebody please help me with this? Oh and this is what happens if I type ionic info in the command prompt:
Your environment has been set up for using Node.js 0.12.4 (x64) and npm.
C:\Users\Singh>ionic info
Your system information:
Cordova CLI: 5.1.1
Ionic CLI Version: 1.6.1
Ionic App Lib Version: 0.3.3
OS: Windows 7 SP1
Node Version: v0.12.4
C:\Users\Singh>
Try to remove the platform, and then add it again, and then build your application.
So, if you have android as targeted platform execute these commands:
ionic platform remove android
ionic platform add android
ionic build android
My son had a very similar problem, and we never did figure out what caused it. He ended up creating a brand new blank ionic project, and then just copying the www folder from the old project. It worked, and he was able to get things building again. If you try it, you'll also have to re-add your plugins, copy package.json and bower.json, and then rerun bower install and npm install. It's not pleasant, but it might be worth a shot if you're desperate.
When I want to try ionic weather app (https://github.com/driftyco/ionic-weather/) I've got problems when I wanted to build android to my phone-gap application using cordova. I receive this message in terminal when I execute the command cordova build android
Error: An error occurred while listing Android targets
I work on ubuntu 13.10
I was able to successfully build the project with the following steps:
npm install -g cordova ionic
git clone https://github.com/driftyco/ionic-weather/
cd ionic-weather
cordova platform add android
cordova build android
You may be missing the required android sdk tools, or they may not have been added to your system path.
Refer to this question
cordova ubuntu: An error occurred while listing Android targets
And follow this guide to ensure your environment was setup correctly.