creating a project with cordova - android

i have been trying to set an android Cordova project:
I have used following instructions:
http://cordova.apache.org/docs/en/2.5.0/guide_getting-started_android_index.md.html
but i get an error on the terminal:
No Android Targets are installed. Please install at least one via the android SDK
I have installed the SDK plugins
Would anyone know what else I may have missed??

Type "android" in your command line to open the android sdk manager and install the sdk versions that you want to be active.
Also install build tools from that list.

Assuming you are trying this on Windows,the Android SDK may not be added to the system path. Add Android 'platform-tools' and 'tools' folder in Android SDK to the system path and that should solve the issue.

I had the same issue and I had to uninstall Android SDK 18 and 19.
I'm now working with SDK 17 and it works.

Related

ionic run android issue

I occured this issue when running ionic run android cmd
Any help ?
Do you have Android SDK? If not, download and install it.
https://developer.android.com/studio/index.html#downloads
Just install it with Android Studio, later you can delete Studio and just leave the SDK (or you can go and find just the SDK but this is easier)
If you already have SDK, go to YourDrive:\Path where you installed\Android\sdk and open SDK Manager
You'll see bunch of Android versions, select android 6.0 (API 23), and download/install through SDK manager. It's not bad to install all versions from let's say API 15 to latest.
When building you will need to have Java path set up.
Refer here if you get something like Java Home not found Error in setting JAVA_HOME

Cordova: still getting the error "please install android target 23" with android-23 sdk installed

I'm trying to build a android cordova based application but I'm always getting this error.
Here the error message on the cli :
cli-error
But, as you can see on the next picture, I have installed the android-23 platform with android sdk manager :
Android SDK manager
Also, the environment variable ANDROID_HOME is correctly set and I have android-sdk\tools and android-sdk\platform-tools in my PATH.
Does anyone have an idea of what could be the problem ?
We need to install all the platform tool for android API version 23. As shown in the image. Also, Need to install all the API Version 23.
Restart your node js command line tool and try again with :
cordova build command, it will work now and download the dependent files.
Ok, the problem seems to come from the path of my project. There is some special characters like '-' and if I try to build a cordova App from another folder (with a path without any '-'), everything works great !
Kindly locate where android.bat is in your android sdk file, After locating run it and it will prompt android sdk manager so make sure you installed all necessary package for android 23. This should work for you, I hope it help??
When adding android platform to cordova you better use your specific targer ( dont follow posts on internet telling you to modify xml files or project.properties).
to do so just use:
cordova platform add android#x.x.x
where x.x.x is your android version for example "4.1.1" will set min sdk version to "22"
if android was already added to your cordova project remove it first:
cordova platform remove android
Hope it helps anyone looking for same answer I was looking for.
Here's what worked for me (MAC OS).
Change the files:
myApp/platforms/android/project.properties
myApp/platforms/android/CordovaLib/project.properties
To the target sdk you installed. In my case, the error was asking me to install android-28. Then I opened android studio and installed android-27 and changed these files to android-27 also. And corodova requirements are fine now!

Cannot find a compatible Android SDK for compilation when running `tns platform add android`

I am following an official NativeScript tutorial and having a problem configuring my OS X environment for android development.
When running tns platform add android I receive the following error:
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 21 or later.
The tns doctor command also returns warnings on android-sdk issues:
Cannot find a compatible Android SDK for compilation. To be able to
build for Android, install Android SDK 21 or later. Run $ android to
manage your Android SDK versions. You need to have the Android SDK
Build-tools installed on your system. You have to install version 22.
Run "android" from your command-line to install required Android Build
Tools. You need to have the latest Android Support Repository
installed on your system. Run $ android to manage the Android
Support Repository.
My android-sdk installation looks like this:
My .bash_profile also includes the followings:
export ANDROID_HOME="/usr/local/Cellar/android-sdk/24.3.4/"
export PATH="$PATH:~/npm-global/bin:/usr/local/Cellar/android-sdk/24.3.4/tools:/usr/local/Cellar/android-sdk/24.3.4/platform-tools"
Should I go further and try setting system-wide environment variables - not just for the .bash_profile? Also, it is possible that I missed something from the setup process...
Any tip on how I could debug this situation (commands, config files etc.) would be great, thank you!
Alright, so you need to make sure of following:
Make sure you have API 22 installed.
Make sure you you have Android SDK Build Tools 22.x.x installed. (Yes,
specifically 22.x.x)
Make sure you have Android support repository installed. (You can
find it under Extras section in Android SDK Manager)
Once you have performed steps mentioned above, run tns doctor again and you should see No issues were detected message.
This is because of sudo. The root user has no ANDROID_HOME set.
For Windows User:
Run 'android update sdk' from command line
Select Android 5.1.1(API22)
Select Tools folder
Select Extras and click on Install.
ps:- adding this answer, so that if any one land on this page can see it.
Check the ANDROID_HOME is ok
Install the API 22 + ion the Extras > Android Support Repository
Run the following
tns platform remove android
tns platform add android#next
Run
tns run android
then it should be OK
I solve this problem installing Android Support Repository from Extras.
updating SDK in AndroidStudio >> Preferenceswould help
on my windows 10 machine I had to open file explorer right click on this pc and go to properties on the left hand side I had to go to advanced settings. At the bottom I click environment variables then on the android_home variable I clicked edit then pointed it to this path on my machine where the sdk was installed
C:\Program Files (x86)\Android\android-sdk
This answer is on a Linux, not OSX, platform. However, since this is the SO that appears most often for the listed error, I'll share a recent fix that worked for me.
If you have done all of the above and are still getting the error, try this solution.
I am using NativeScript 8.0.2.
You will know that ANDROID_HOME and Java are configured correctly if you can run the command $ANDROID_HOME/tools/bin/sdkmanager --list. If that fails, then first check that your Java is compatible (I had to add OpenJDK 8 and change my PATH with export JAVA_HOME="/usr/lib64/jvm/java-1.8.0/")
In Android Studio, add a previous build tool version. Go to your SDK Manager > SDK Tools, tick the bottom box "Show package details", and add a previous version. In my case, 31.0.0 was the latest, and I added 30.0.3. Now run ns doctor android again and everything should pass.
Seems 31.0.0 is not yet properly recognised by Native Script.
I always got the error "✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later. "
I actually had to go to the android studio settings and install the exact SDK 28 before this error went away.
Android Settings Pic
This is an updated answer, I also had the same issue:
Like all the previous pictures above, I had to install the SDK platforms, using the SDK Manager. From the main screen of Android Studio, click More Actions and choose SDK Manager. Before that I had to add the platform-tools to my PATH in Windows
%LOCALAPPDATA%\Android\Sdk\platform-tools
That fixed my issue and the docs for setup are here.

What Type of error is it? [duplicate]

When I boot up Android Studio and select "New Project..." and go through creating a new project, I get this popup error:
Failed to import new Gradle project: failed to find Build Tools revision 17.0.0
Consult IDE log for more details (Help | Show Log)
I would love to consult the IDE log, but I haven't even managed to get into the application to do much of anything. I've went through the preferences multiple times to see if I can set a path for the Build Tools, but I can't find much of anything. How do I fix this, or how do I get into the application without opening a project so I can at least see the logs?
After spending a few hours: I restarted the Android SDK Manager and at this time I noticed that I got Android SDK Platform-tools (upgrade) and Android SDK Build-tools (new).
After installing those, I was finally able to fully compile my project.
Note: The latest ADT (Version 22) should be installed.
As of May 2020, A really straightforward solution using Android Studio:
Open Android Studio
From the top, choose File > Settings > Appearance & Behavior > System Settings > Android SDK
click on the tab SDK Tools at the top. Then highlight Android SDK Build Tools from the list.
Check "Show Package Details" check box, choose the build tools version you need and then click Apply.
Look in the SDK Manager what is your highest Android SDK Build-tools version, and copy this version number in your project build.gradle file, in the android/buildToolsVersion property (for me, version was "18.1.1").
Hope it help!
This is what I had to do:
Install the latest Android SDK Manager (22.0.1)
Install Gradle (1.6)
Update my environment variables:
ANDROID_HOME=C:\...\android-sdk
GRADLE_HOME=C:\...\gradle-1.6
Update/dobblecheck my PATH variable:
PATH=...;%GRADLE_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
Start Android SDK Manager and download necessary SDK API's
It happens because Build Tools revision x doesn't exist.
Today, the latest version is 23.0.2 (subject to change all the time).
The buildToolsVersions you want are included in the Android SDK, normally installed in the <sdk>/build-tools/<buildToolsVersion> directory.
Don't confuse the Android SDK Tools with SDK Build Tools.
Change in your build.gradle's buildToolsVersion to some version installed in <sdk>/build-tools
android {
buildToolsVersion "23.0.2"
// ...
}
Whenever you will try to run a project with build tool version not present in studio, You will face this error.
As of now in 2017, It has been made really simple by Android Studio.
It will prompt you about this issue, along with something like this
You just have to click on it and the system will download to the build version required to run the project.
I had the API 17 installed but that was not enough. What I really need installed is the "Android SDK Build-Tools 17".
You can locate your "Android SDK Build-Tools X" inside the first child, named "Tools", in the "Android SDK Manager".
in your Project perspective, look for Application --> build.gradle and edit this lines
android {
compileSdkVersion "android-N"
buildToolsVersion "24.0.0 rc1"
like this:
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
I had this problem recently, my project didn't include local.properties file.
Check local.properties file if it includes sdk.dir with correct path to sdk
i think you can download the latest android SDK and use it.i do this and fixed the problem and work well.
here is the link:
http://developer.android.com/sdk/index.html#download
Try to run gradle at the command line first. It might prompt you to setup and environment variable:
export _JAVA_OPTIONS="-Xms256m -Xmx1024m"
Read more here: 1, 2
Further make sure that the Android SDK build tools (adb, aapt, dx, dx.jar) are available in the PATH. If not you can create symlinks at the appropriate locations. They changed with the release of new SDK versions. Here is a shell script which creates the symlinks within the $ANDROID_HOME folder for you.
Basically error saying your are missing "Android SDK Build-tools" installed.
This worked for me after I tried many solutions:
For some reason the adb process didn't restart itself after installing new packages. Manually killing adb.exe and attempting to import the project another time solved this problem for me.
Uninstall the Android SDK Tools and then reinstall them from Tools > SDK Manager.

How to determine the version of android SDK installed in computer?

How to determine the version of Android SDK installed in my computer?
<Program files>\Android\Android-sdk\platforms\<platform SDK's>
On a 32bit machine:
"<Program files>" will be \Program Files\
On a 64bit machine:
If you installed the 32bit ADT, "<Program files>" will be \Program Files (x86)\
If you installed the 64bit ADT, "<Program files>" will be \Program Files\
Type in android list target into your command line to see what android API you are using.
C:\ <path to android sdk> \tools\source.properties (open with notepad)
There you will find it.
Android Studio is now (early 2015) out of beta. If you're using it as your development platform, the SDK Manager is probably the easiest way to see what's available. To start the SDK Manager from within Android Studio, use the menu bar: Tools > Android > SDK Manager.
This will provide not only the SDK version, but the versions of SDK Build Tools and SDK Platform Tools. It also works if you've installed them somewhere other than in Program Files.
You can check following path for Windows 10
C:\Users{user-name}\AppData\Local\Android\sdk\platforms
Also, you can check from android studio
File > Project Structure > SDK Location > Android SDK Location
open android sdk->click on tools tab->about and u get the entire details!
In the case of Linux, You get the version of Android SDK using sdkmanager.
your_path/android-sdk/tools/bin/sdkmanager --version
in my case
/var/lib/jenkins/android-sdk/tools/bin/sdkmanager --version
While some responses have shown how to get the versions of the installed Android SDKs and various Android SDK related tools using the Android SDK Manager GUI, here's a way to get the same information from the command line:
%ANDROID_HOME%\tools\bin\sdkmanager.bat --list
You can redirect the output to a file to ease review and sharing.
Note: In my corporate environment, I also had to use the --proxy, --proxy_host, and --proxy_port command line options. You may need to use them as well.
I develope cross-plateform mobile applications Using Xamarin integrated in Visual Studio 2017.
I prefer to install and check all details of Android SDK from within the Visual Studio 2017. This can be found under the menu TOOLS -> Android -> Android SDK Manager.
Bellow is the Visual representation of the Adroid SDK Manager.
If you prefer to manage from UI, type android in command windows which will open the Android SDK Manager. Or you can directly open from C:\Program Files (x86)\Android\android-sdk\SDK Manager.exe
Create a Batch file (.bat) in Windows with the following command in it:
%ANDROID_HOME%\tools\bin\sdkmanager.bat --list && pause
NOTE: Using && pause is necessary to be able to review the information, once it is listed. If not used, the batch file will simply run, show the information in just mere few seconds and exit right away.

Categories

Resources