i am using cordova version 6.5.0.
after following the instructions on cordova site , i have wrote those commands in the CLI
cordova create myApp com.myCompany.myApp myApp
cd myApp
cordova plugin add cordova-plugin-camera --save
cordova platform add android --save
cordova requirements android
i get this error:
i have installed android studio on its default location.
C:\Users\Liran\AppData\Local\Android\sdk
i have the sdk tools installed as it is shows in sdk manager.
what else can i check to solve it?
Setup the Environment Variables at control Panel, selecting Advanced system settings, and clicking Environment Variables.
Then add the ANDROID_HOME variable with the value:
C:\Users\Liran\AppData\Local\Android\sdk
Then setup in the variable path in your Environment variables in the end something like the next line, add first semicolon
[[text in path];%ANDROID_HOME%;
Check this link: https://spring.io/guides/gs/android/#android-dev-env
Related
I am trying to add the buildinfo Cordova plugin to my project, to which I have added an Android platform. I was able to add rest of the required Cordova plugins.
Does it have anything to do with my Android version (6.4.0)?
Also, after running command cordova plugin add cordova-plugin-buildinfo, it shows the attached screen but the buildinfo plugin folder along with the required contents gets created at my project's Plugins folder, but not inside the Plugins folder of the Android Platform inside my Cordova project.
Plugins Folder contents
Also kindly note that I have set my ANDROID_HOME and Path environment variables as seen in the below pictures:
P.S. I am able to add the mentioned plugin to another Cordova project in my system!
Your Android_Home environment variable is not set correctly or not set at all due to which this plugin is not able to install. Please make sure that Android_Home environment variable is set correctly.
For Windows:
set ANDROID_HOME=C:\installation location\android-sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
For how to set Android_Home on windows machine, have a look here
The error message makes it sound like you may need to install the platform-tools in Android Studio's SDK Manager. To install them, follow these steps:
Open Android Studio
Tools -> SDK Manager
You should see a list of SDK Platforms in a new popup window, click on the SDK Tools tab
Check Android SDK Tools and hit Apply
That will install the latest version of the Android SDK Tools and hopefully will clear out your error message.
I m cloning a cordova app sourcecode from github. How do I install cordova and add android platform to it and build it in Android Studio?
After cloning the code, I am installing cordova, but cant add platform or anything related to cordova. Is there any tutorial on how to follow the correct steps to make it run in Android Studio? I am very new to Cordova. Thanks!
First of all: follow the GitHub repo's README and look for installation instructions.
To play around with a cordova app, you most definitely need the cordova CLI. If you haven't already, install NodeJS and npm from http://nodejs.org or using your package manager of choice. Then inside a terminal run
npm install -g cordova
(If you are using Linux you probably have to run that command with sudo)
Now you navigate into the cloned github repo and run
cordova platform add android
cordova build android
It will create a directory under ./platforms/android which you can open using Android Studio. Then you can run the app with an emulator or a connected device.
If at any point you receive error messages or you think something is missing, you can run (inside the GitHub cloned repo)
cordova requirements
It will show you if the cordova CLI is missing something. You will have to fix all the errors that come up. Consult the cordova documentation under https://cordova.apache.org/docs/en/latest/guide/cli/#installing-the-cordova-cli in order to do that.
Hope this helped.
Please note I am not a programmer . I am ex Banker and entrepreneur now .I got really frustrated while setting cordova with all those errors for building android apps in windows. Though, I now understand this is the simplest cake, if you know the know-how. I love coding, so I am sharing the whole length of steps . You can figure out what step you are missing.
Step 1. Requirements :
(a)node js ( npm )-- install it
(b) Install cordova by command -->
npm install -g cordova
(c) Install Phone gap by command --> npm
install -g phonegap
(d) Ant apache ( download bin not source ) by visiting
https://ant.apache.org/bindownload.cgi . Keep this in C:/ Program files
(e) JDK version 8 . you can down load previous version by visiting
oracle.com
NOTE : Keep ( ANT ) and JDK in Same Folder i.e extracted (d) and (e) in C:/Program files
Step: 2 Setting Environment Variables
you can visit : Control Panel\System and Security\System--> environment variables You can see two types of windows : User and System
User Environment Variables:
You have to set ANT_HOME and JAVA_HOME
Add new variable :
Variable name :ANT_ HOME
Variable value : C:\Program Files\apache-ant-1.10.3
Variable name :JAVA_ HOME
Variable value :C:\Program Files\Java\jdk1.8.0_172
System Environment Variables: edit path and at the end use ; and paste ant/bin address
PATH :
Variable name :path
Variable value :....C:\composer;C:\Program Files\Git\cmd;C:\Program Files\apache-ant-1.10.3\bin
NOTE : Check ant & java configuration by windows command prompt :
ant -version and java --version . If using git then git --version.
If you error free then proceed further.
Step 3. Create a cordova project
something like this command: cordova create hello com.example.hello HelloWorld
Step 4. create platform android or ios: ensure proper config.xml
**Step 5. now check cordova requirements: This work in app folder only **
Now build your app.
Other errors you get if you miss these:
check ="ANDROID_SUPPORT_VERSION" in config xml.
Add Required Plugin - cordova plugin add -- as you need in config.xml
Cordova requirements: This work in app folder only
Cant find the Ant Version: you have not used ANT_HOME, JAVA_HOME folder name.Ensure ANT_Home and JAVA_HOME only in User folder while the path in System Variable. Never use / " or ' in writing these variables.
"IF YOU DONT REQUIRE ANT AND GIT ---> Dont download it "
Hope this helps beginners and code layman like me.
Answered on: Android Studio project detected
My .bash_profile looks like this
export PATH=$PATH:/Users/subbarao/Library/Android/sdk/platform-tools/
export ANDROID_HOME=/Users/subbarao/Library/Android/sdk/
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
even $(user/libexec/path_helper -s)
When I give ionic platform add android I am getting like this
When I give ionic run android I am running into this error
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: /Users/subbarao/Library/Android/sdk/tools/templates/gradle/wrapper
You have cordova-android v 6.1.2. There was an issue with cordova-android. Check this answer.
Try
ionic platform add android#6.2.1
Or
ionic platform add android#latest
Update:
if you are using ionic cli v3, the command is
ionic cordova platform add android#latest
Update SDK and gradle version and then try following commands in the terminal
export ANDROID_HOME=/Applications/ADT/sdk
PATH environment variable
export PATH=$PATH:$ANDROID_HOME/bin
Im trying to build an android app with ionic 2. When I try to run ionic platform add android I get this error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually. Failed to find 'android' command in your 'PATH'.
Im using linux mint and already set the environment variables like this:
export ANDROID_HOME=/home/mauro/Android/Sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
When I type android in the console, the sdk manager gets started.
My ionic version is: 2.1.7
and cordova: 6.4.0
Hope anybody can help me with this issue.
Instruction 1:
After adding your ANDROID_HOME, make sure you do the below:
Restart your System or run source ~/.bash_profile
Remove Android platform from your project ionic cordova platform rm android or ionic platform rm android
Add Android platform ionic cordova platform add android
Then ionic cordova run android or ionic run android
Instruction 2:
To set your ANDROID_HOME and JAVA_HOME, follow the below steps:
Run command open ~/.bash_profile
Paste the below in the file that opens on your Text editor
export ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Save - "Command S" or "Ctrl S"
Then Follow the "Instruction 1:" above
Hope this helps.....
I have the same issue. It seems to be an issue of the combination of cordova, the installed Android SDK version and the profile settings.
This is what worked for me on ubuntu 16.10:
get an older cordova that is known to work:
npm install -g cordova#4.2
(I was on 6.4.0 and 5.0.0)
in .profile:
PATH="~/Android/Sdk/platform-tools:~/Android/Sdk/tools:$PATH"
export ANDROID_HOME=~/Android/Sdk
(Seems you are good there)
I needed the latter to stop the complaining about it even while android was in my path and it also gave me meaningfull errors, which was that API 22 was missing.
Load the profile in current bash:
source ~/.profile
Type android and install SDK 22.
Exit when done and type
ionic build android
and it should work.
After updating to meteor 1.2, I am not able to get my app to build for android. I have followed the instructions on https://github.com/meteor/meteor/wiki/Mobile-Development-Install:-Android-on-Mac to the end.
I get the following error when I run meteor run android-device --verbose :
Getting installed version for platform android in Cordova project
Getting installed version for platform ios in Cordova project
Checking Cordova requirements for platform Android
Your system does not yet seem to fulfill all requirements to build apps for
Android.
Please follow the installation instructions here:
https://github.com/meteor/meteor/wiki/Mobile-Development-Install:-Android-on- Mac
Status of the requirements:
✓ Java JDK
✓ Android SDK
✗ Android target: Android SDK not found. Make sure that it is installed. If it
is not at the default location, set the ANDROID_HOME environment variable.
✓ Gradle
I have run rm -rf .meteor/local, export ANDROID_HOME=~/Library/Android/sd, export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-toolsexport ANDROID_HOME=~/Library/Android/sdk, i even set the environment in the server as process.env.ANDROID_HOME = '~/Library/Android/sdk';.
I am not sure how to get this to work, any help will be greatly appreciated.
#junior try giving the complete path of the android sdk...i hope this works...and see if the requirements match...because, it does say all the requirements don't match.....
set ANDROID_HOME=C:\\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
MAC
export ANDROID_HOME="/Users//Library/Android/sdk/"
export ANDROID_TOOLS="/Users//Library/Android/sdk/tools"
export ANDROID_PLATFORM_TOOLS="/Users//Library/Android/sdk/platform- tools"
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS
and again try re-installing
$ android
and then go to a Cordova-based project directory
$ ionic platform add android
or try this link
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.