I am new to cordova. Trying to work out with it but when I check requirements it says Android Target not installed while I have installed SDK in Android Studio.
Required information for troubleshooting can be found here.
I am using Windows 8.1 32 bit installation. I have already tried previous answers found oh the site.
Update
I just noticed that running cordova build android gives
D:\Android\Apps\hell>cordova platform ls
Installed platforms:
android 7.0.0
Available platforms:
browser ~5.0.1
ios ~4.5.4
osx ~4.0.1
windows ~5.0.0
www ^3.12.0
Indicating android version to be 7.0.0 thus API is 24.
But D:\Android\Apps\hell\platforms\android\CordovaLib\project.properties have :
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-26
apk-configurations=
renderscript.opt.level=O0
android.library=true
Here target is set to android-26, which is Android 8.0
From what I can tell the path setting for the SDK is missing. Check the Cordova documentation for that. Follow it to the letter.
Also Android 7.0.0 is not the version of Android, but of the Cordova code for Android.
Josem might be onto something as well, unless you've already done that step.
Perhaps the platform android is not installed.
Can you see it?
ionic cordova platform list
If it is not there, you can add it:
ionic cordova platform add android
Here is the documentation.
Related
I'm struggling to get my development environment set up for Apache Cordova. I'd like to target an Amazon Fire HD 7 running Fire OS 5.3.6.4 (626532920).
Wikipedia tells me that:
The releases are chronologically sorted and categorized based on the underlying version of their Android codebase.
So I'm assuming that this is built on Android 5.1.1 Lollipop?
Project setup
I first installed Cordova using
yarn global add cordova
I then generated a new project using
cordova create hello_world com.mycompany.hello_world HelloWorld
I added Android as the intended platform using
cordova platform add android
(which installed cordova-android#~7.1.1)
Requirements
After running cordova requirements I received the following:
Requirements check results for android:
Java JDK: not installed
Failed to find 'JAVA_HOME' environment variable. Try setting it manually.
Android SDK: not installed
Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
Android target: not installed
android: Command failed with exit code ENOENT
Gradle: not installed
Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.
Might need to install Android SDK or set up 'ANDROID_HOME' env variable.
Some of requirements check failed
I resolved (most of) these issues as follows:
Java JDK
I installed Java 8 using brew cask (as later versions of Java don't seem to be compatible)
brew tap caskroom/versions
brew cask install java8
Android SDK
You first need to create the empty repositories config, otherwise the later steps will fail
touch ~/.android/repositories.cfg
This then left things looking a lot healthier as far as cordova requirements is concerned:
Android Studio project detected
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
No android targets (SDKs) installed!
Gradle: installed /usr/local/Cellar/gradle/4.10.2/bin/gradle
Some of requirements check failed
However I'm struggling with how to set up an Android target for this device.
I think I need to run something like
sdkmanager "platforms;android-27"
But I'm not sure which version of Android I should be using. There is a handy table on the Cordova site but it doesn't make a whole lot of sense to me...
I am in the process of setting up a new Cordova CLI toolchain to build hybrid Android apps that target Android 5.1+. I am using
Node 8.9.2
Cordova 7.1.0
After issuing a cordova create... command to create a new Cordova project I proceeded to add Android 5.1 using cordova platform add android#5.1.0 which went smoothly.
I have also ensured that I have the relevant Android SDKs available and pointed at properly via ANDROID_HOME. I currently have SDKs 19 through to 27 installed.
However, when I issue a cordova build android I get the message Error: Android SDK not found. Strangely enough if I let Cordova install its current default Android version via cordova platform add android which adds Android 6.3.1 it then lets me build the project without any further ado.
Is this a matter of Cordova 7.1.0 simply not wanting to play ball with lower versions of Android or is there something else going on here? Can I get around this by installing an older version of Cordova via npm? If so, which version should I install - and how?
Your problem is you're adding an old version of the cordova-android platform project, (v5.1.0) which is over 2 years old and not compatible with the cordova#7.1.0 CLI.
If you want to target Android 5.1+, you don't need to use cordova-android#5.1.0, you need to specify a preference in the config.xml to target Android 5.1 (API 22) and above:
<preference name="android-minSdkVersion" value="22" />
You probably want to use the default cordova-android platform version (6.3.1), unless you need to do stuff with Android Studio 3, in which case use cordova platform add android#latest which will add cordova-android#7.0.0 and requires Gradle 4 to build (see here).
The error I get on the console; When I run the command "phonegap emulate android"
->Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK. Looked here: C:\Users\wende\AppData\Local\Android\sdk\tools\templates\gradle\wrapper
I also experienced this issue (among many others) in my attempts to get a phonegap app to work in my environment.
I found a solution in the second response (by jcesarmobile) to this question:
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK - Android
Specifically, I had to make sure my Android Studio and Android SDK Tools were updated to the latest version, and then I had to update my Cordova Android platform to version 6.2.2.
phonegap cordova platform rm android
phonegap cordova platform add android#6.2.2
For a client of mine, I try to run the meteor run android command on a mac and I got the following message:
✓ 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.
The situation so far:
PATH is correctly defined with links to the tools and to the platform-tools, ANDROID_HOME is fine too
The emulator and the SDK are installed with Android Studio
gradle is not found either, the tools/templates/wrapper path does not exist, which make me suspect a bad SDK installation, yet Android Studio handles everything
Meteor version is 1.3.3 for this project, and of course android paltform has been added to the project, which run fine on my Linux laptop
Verbose is not that verbose, in which situation Android SDK is okay and Android target is not ?
This is very hard to debug and I am desperate to find a solution, this issue seems unresolved in other related threads. Thanks for your help!
This is actually a bug due to the new version of the Android SDK Tools (> 25.3).
The solution is to go back to 25.2.x, the Meteor guide mobile page has been updated a few hours ago.
See the related Github issue
Links to download 25.2.5 version:
https://dl.google.com/android/repository/tools_r25.2.5-linux.zip
https://dl.google.com/android/repository/tools_r25.2.5-macosx.zip
I cloned an existing ionic project from git. I have ionic 1.3.2 and cordova 4.2.0. After cloning, i cded into the directory and did an ionic browser add crosswalk. It says that crosswalk was added successfully. Then when i try to do ionic run android, it says
No platforms added.
So i do a ioinic platform add android, which gives me this error:
Failed to install 'org.apache.cordova.engine.crosswalk':CordovaError: Plugin doesn't support this project's cordova-android version. cordova-android: 3.6.4, failed version requirement: >=4.0.0-dev`.
ionic platform add android#4.0.0-dev returns
Unable to fetch platform android#4.0.0-dev: Error: version not found: cordova-android#4.0.0-dev
How do I fix this?
P.S. I am using ubuntu 14.04
The problem is crosswalk browser.
If you revert back to android webview, which sucks, but works.
ionic browser revert android
ionic platform rm android
ionic platform add android
As of today, 4/9/2015. I have been able to go back to the old projects and add crosswalk after updating node runtime, ionic, cordova
Before running ionic run android have you tried adding a directory named www?
It seems that by entering ionic platform add android, it installs the platform from the npm and the latest cordova-android version, which is.... 3.7.1 (currently)
Cordova-android 4.0 is still beta, but there's good news for those who wish to install it. You can download the 4.0 version directly from the apache github repository:
ionic platform add https://github.com/apache/cordova-android.git
There are more bugs along that road, but at least it's a working solution for that bug. It seems that apache still have plenty of issues with plugins compatibility, hopefully they'll overcome them in the next official release.
Update:
Download Intel XDK. This is just an unbelievable tool for developing mobile apps, Intel has really figured it out imo. Built in brackets, emulator, remote debugging, and most important: One button click to build apks with crosswalk for android. All you have to do is importing your www folder and you are good to go!
My app went from sluggish 5fps while scrolling to fully native feel in a click. I'm still in awe. :)