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.
Related
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 going through salesforce trailhead "Get Started with Hybrid Development".
Now, I try to create a forcedroid hybrid android app with command "forcedroid create".
E:\TempTry>forcedroid create
Enter your application type (native, hybrid_remote, or hybrid_local): hybrid_local
Enter your application name: MyTrailHybridLocal
Enter the target directory of your app: TrailHybridApps
Enter the package name for your app (com.mycompany.my_app): com.mytrail.hybrid
But I failed and got an error message as below.
". Should be in the format x[.y[.ignored]]
) is less than the minimum required version (5.4.0). Please update your version
of Cordova.
In fact, folder TrailHybridApps exists and it is empty. And my Cordova is v6.3.0.
E:\TempTry>cordova -v
6.3.0
So, what's wrong? And what can I do now?
Thanks in advance.
In fact, I have succeeded in finishing a Cordova android app acoording to the guide: https://cordova.apache.org/docs/en/latest/guide/cli/
So, I think my Cordova has no problem and it seems that the question resulted from the "npm forcedroid". On the other hand, I have not github installed. Does it have anything to do with github?
Before running forcedroid create, run this command:
cordova telemetry off
Then forcedroid create should work. Or, you could uninstall Cordova and reinstall with a specific version, i.e.:
npm uninstall -g cordova
npm install -g cordova#5.4.0
You don't have to do anything with github.
You need to update your cordova. This guide shows how to modify Android projects to upgrade from older versions of Cordova. Most of these instructions apply to projects created with an older set of command-line tools that precede the cordova CLI utility. See The Command-Line Interface for information on how to update the version of the CLI.
https://cordova.apache.org/docs/en/latest/guide/platforms/android/upgrade.html
Thanks to you all.
At last I worked out this problem. I would like to share with you all here.
I think it must be a bug of Cordova V6.3.0 or forcedroid create.
Refer to : https://github.com/forcedotcom/SalesforceMobileSDK-Android/issues/1209
As for me, Cordova V6.2.0 works fine while V5.4.0 seemed to result in another error message: Error:'com.android.build.gradle.BasePlugin'.
npm uninstall -g cordova
npm install -g cordova#6.2.0
'cordova telemetry off' doesn't work for me.
Thanks again, special to Richard W, miken32, Ali Nfr and Rajasekar.
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
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.
I am trying to create a phonegap / cordova app using the 3.1.0 version.
Created my app with the command:
cordova create hello com.example.hello HelloWorld
And after running this command:
cordova platform add android
to add android platform, i am getting:
[RangeError: Maximum call stack size exceeded]
Any idea what could be the issue?, previously i created another app, but same error was occurring when adding camera plugin.
I faced the same issue, but I was actually issuing the command in wrong directory, so firstly I changed the directory to Hello then issued the command.
So, I have directory structure as,
---Cordova
---Hello
and I was actually issuing the command by being at Cordova folder. After that I changed the folder to Hello then executed this cordova platform add android and it worked.
Please check once
be sure you are located in the created directory (Hello, I guess), the same level with .cordova
cd Hello
For anyone coming to this question after July 2013 (when Cordova 3.0.0 was released), there is another reason for this problem.
If you created a Cordova project on a computer with Cordova 3.x and you are trying to work with it on a computer that still has the old 2.x version, you will get this error because of how the project structure changed between the versions.
Upgrading Cordova to the newest version using npm install -g cordova will fix the problem.