cmake: "cannot execute binary file" on osx android build - macos

On OSX, when running an android gradle build it gives me the following:
android-sdk-macosx/cmake/3.6.3155560/bin/cmake: cannot execute binary file
I've tried
chmod +x,
reinstalling the android sdk build tools
googling
OSX 10.11.6 Gradle 2.14.1 Android SDK 23.0.2
Its a Superpowered(.com) Android project

After upgrading to Android Studio 2.2, it installed cmake and it now works correctly. Its unclear exactly why as it seems to be the same exact version of cmake.
Part of the problem was that I was actually using the latest stable version of IntelliJ which is still using Android Studio <2.2 level.

Related

BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61 on Apple Arm

I have installed Android Studio Canary 2020.3.1.22 and trying to run Flutter project on Apple Silicon(ARM) Mac. Unfortunately, it is giving me this error when I try to run default flutter counter app.
Here is the error I am getting:
Could not open settings generic class cache for settings file '/Users/khamidjonkhamidov/StudioProjects/dummy/android/settings.gradle' (/Users/khamidjonkhamidov/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61
Gradle version: 6.7 but I tried 7+
JDK version 17
I would really appreciate your help)
According to the official grade docs: Java 17 and later versions are not yet supported.
You can check compatibility here.
So I have installed Java11 from Azul.
p.s. don't forget to change jdk version in Android studio
Preferences -> Build -> Build Tools -> Gradle -> Gradle JDK
Got the same error while I upgraded my build.gradle to Java 17. And the fix is as simple as we think:
Gradle starts supporting Java17 only from 7.3 release
Here's the complete reference for Java vs Gradle compatibility:
https://docs.gradle.org/current/userguide/compatibility.html
Upgraded my gradle to 7.3 in gradle-wrapper.properties.
https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
Some of you may experience now the Gradle dependency cache corrupt error after this like me. So better delete the gradle-wrapper.jar and reinstall it using the command:
./gradlew wrapper
Everything will work perfectly fine from here.
In case if you still face Gradle corrupt issue, please check whether you are using latest version of IDE especially Intellij.
First, you can execute this command: /usr/libexec/java_home -V, to retrieve all installed jdsk:
[~]$ /usr/libexec/java_home -V
Matching Java Virtual Machines (4):
17.0 (x86_64) "Oracle Corporation" - "OpenJDK 17.0" /Users/ciccio/Library/Java/JavaVirtualMachines/openjdk-17.0/Contents/Home
14.0.1 (x86_64) "Oracle Corporation" - "OpenJDK 14.0.1" /Users/ciccio/Library/Java/JavaVirtualMachines/openjdk-14.0.1/Contents/Home
11.0.12.1 (x86_64) "Amazon.com Inc." - "Amazon Corretto 11" /Users/ciccio/Library/Java/JavaVirtualMachines/corretto-11.0.12/Contents/Home
10.0.2 (x86_64) "Oracle Corporation" - "Java SE 10.0.2" /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
1.8.0_302 (x86_64) "Amazon" - "Amazon Corretto 8" /Users/ciccio/Library/Java/JavaVirtualMachines/corretto-1.8.0_302/Contents/Home
Now, imagine you want to remove the version 17:
[~]$ java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment Homebrew (build 17+0)
OpenJDK 64-Bit Server VM Homebrew (build 17+0, mixed mode, sharing)
Go into the path of the version you want to remove (in this case "/Users/ciccio/Library/Java/JavaVirtualMachines/openjdk-17.0/Contents/Home"), and delete entire folder: "/Users/ciccio/Library/Java/JavaVirtualMachines/openjdk-17.0".
Once removed, go back on terminal and use:
[~]$ /usr/libexec/java_home -v 14.0.1 --exec javac -version
javac 14.0.1
to force the new version to use (14.0.1).
Next check if is correct:
[~]$ java -version
openjdk version "14.0.1" 2020-04-14
OpenJDK Runtime Environment (build 14.0.1+7)
OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
[~]$
Your Gradle now is back to work.
Basically, I installed jdk using brew install java which was not compatible with my current gradle I guess. So
I uninstalled java first using: brew uninstall java
installed JDK 8 or JDK 11 from azul.
Installed gradle: gradle-6.9-all.zip
When done, everything worked smoothly.
I found a way to fix this error without messing with the locally installed Java version or Gradle. Here is what I did:
If you are developing a Flutter project and got this error, go to File -> Close Project.
Then re-open from the android folder (omit this if you received from a pure Android project).
Now, Gradle may detect the issue on its own, and it will take a while to check. After it is done, it may provide upgrade steps in an upgrade assistant window at the bottom of the window along with logcat, build, terminal etc… which you need to accept and tell it to execute. Once it finishes, the error is resolved, and you are good to go.
If it does not seem to do anything on its own, then please open the Project Structure tab. Now select the latest Gradle version available that does not contain -rc (you don't want these, most of the time they are not stable releases).
Now select the JDK version that Gradle uses by going to Gradle (sidebar on the right of the window) -> Wrench Icon -> Gradle Settings. Select a compatible JDK version according to the Gradle project's documentation, as found HERE. Current latest stable version of Gradle is 7.4 with maximum supported JDK version 17 (also latest I believe if you use something like openJDK which I use), but Android Studio version at 7.1 so be careful.
Tested on MacBook Air M1 running macOS Monterey 12.2.1.
I faced this error when I updated my android studio
Solution:
you need to upgrade your distributionUrl According to the java version
‌Below is the Java version and Supported Gradle version
Check currently active java version:-
javac -version
If it is greater than 11 downgrade it to 11 or 8. Check your available java jdk version installed:-
/usr/libexec/java_home -V
If java 11 or 8 is not installed first install one of them using this link:- Download jdk 8
then change the default java version in .bash_profile
Edit .bash_profile
sudo nano ~/.bash_profile
Add 1.8 or 11 as default. (Add below line to bash_profile file)
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
OR
export JAVA_HOME=$(/usr/libexec/java_home -v 11)
Now Press CTRL+X to exit the bash. Press 'Y' to save changes. And reload bash_profile
source ~/.bash_profile
Happened with newly created Flutter app in 2023 January with Mac Mini M1. If you have another working Flutter apps do not downgrade or update Java version as it will cause problem with all other working ones. Find gradle-wrapper.properities file inside gradle/wrapper folder (directly inside Android folder) and check gradle version. You just need to use newer version of gradle. I replaced this one and used flutter run command from terminal and it worked:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
With this one:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
No need to do anything else. Version number may be different for you depending on when you are trying this and what Java version you have.
Finally I Got the Solution
It is very easy to solve
step 1 : select the gradle version which support your java version link
step 2 : open your project navigate to your_project_name/android/gradle/wrapper/gradle-wrapper.properties
step 3 : in distributionUrl change the gradle version according to your java version
That's it No need to install older java versions
Happy coding
System: Mac M1, Android Studio Electric Eel (2022.1.1 Patch 1), JDK 19.02
I encountered this error when created a fresh project using flutter create and tried to run it in Android Studio.
Now I've got an interesting solution that worked for me:
Open the flutter project in Android Studio
Open build.gradle, the one under android folder
On the top right it shows "Open for Editing in Android Studio" (although it's already in Android Studio!). Click on that to open it for editing. I opened it in another window, but doesn't matter.
It starts to automatically download and update gradle to sync the build file. At one point, tt might also prompt you to upgrade gradle, which is good to do.
Done! Close the build.gradle and re-run the project. It should build and run fine.
I had this issue when I set the target for a new IntelliJ Kotlin project to be Java 17. My fix was to:
set the target to 9 in build.gradle.kt
close the project
delete the .gradle and .idea directories from the project folder
remove the project from the recent projects list
open the gradle file from IntelliJ and get it to rebuild everything
Open the Gradle settings and change the Gradle JVM to the same JDK version you are using.
(I am using 14.0.2)
This worked for me.
I had that Issue creating Projects from IntelliJ.
It seems the issue was the Gradle JVM Version.
Here is a configuration that works:
System:
Mac with ARM, Mac OS 12.1, M1 Max
java version 18.0.1-zulu
kotlin version 1.7.0
gradle version 7.5
I installed those version with sdkman https://sdkman.io/
and set the config manually on intellij (See attached Screenshot for Details)
IntelliJ Gradle JVM config
My solution was to open the android project in Android Studio. It detected the needed Gradle update and performed the update upon command.
I can't speak for everyone, but for me, I went into Flutter project's file android/gradle/gradle.properties, and changed the org.gradle.java.home value so that it pointed to a folder containing JDK 11 instead of JDK 18. That way, it used a JDK version that was actually supported.
On my side I fixed this issue by setting the default Java Version to 8 (download it if needed)
Mac:
Open Terminal.
open ~/.bash_profile
Add
# SWITCH TO JAVA VERSION 8
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
Save and restart Android Studio.
Giving my two seconds here...
In my case, I could fix it by finding my gradle version in the file gradle.wrapper.properties and checking the compatibility with the JDK, so I needed to install the JDK 16, so in my build.gradle(:app) I put this line of code inside the android {} :
compileOptions {
sourceCompatibility JavaVersion.VERSION_16
targetCompatibility JavaVersion.VERSION_16
}
After this I build my android version again, and it worked.
I ran into this issue on VSCode+Mac using the Gradle for Java extension.
My project uses Java 17 but Gradle was using JDK19, which I also had installed.
I removed the jdk-19.jdk folder from /Library/Java/JavaVirtualMachines and then ran the "Clean Java Language Server Workspace" task in VSCode.
After that, Gradle successfully built and I was even able to put the jdk-19 folder back and things continued to work.
Changing the Java Version in the Intellij resolved the issue.
Easy fix in 2023:
Command in the terminal:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Check classpath, current working one:
classpath 'com.android.tools.build:gradle:7.1.2'
Check gradle-wrapper.properities file:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
If still not solved you need to change Gradle JDK from inside Android Studio like below.
After that you can run fluter app directly from terminal without any issue. Note: Android Studio default JDK (11.0.15) does not work and causes this issue. Azul Zulu 16.0.2 works and solves the issue.
In my case, I use the react native cli and my android gradle is 7.3.1. I open the android folder in the android folder in the android studio and it suggests my gradle once after degradation it works fine
Windows Users
Open Android Studio and Click on Setting ICON far right. And Go to Project Structure Option and select the SDK's Version 11.0.15 and click apply than on the left side click on Module Option and select Module SDK's options and select Project SDK 11. and at the bottom at Project Settings CLICK on SDK and select on 11 SDK versions. It will give you the JDK path
C:\Program Files\Android\Android Studio\jbr
Copy this path and Open the System Environment Variable Create a New JAVA_HOME path with the location
and click OK and save everything Now run your app in ANDROID STUDIO and ENJOY!
Context: Flutter, Mac M1, Java 19.0.2
Problem occured on following command:
flutter build apk
I just installed (reintalled) gradle via homebrew like this:
brew install gradle
I suppose it was related to my recent upgrade (Java was upgraded to OpenJDK Temurin 19.0.2).
I also noticed that flutter command was trying to use gradle 7.4 (the only one gradle version installed before). As previously mentioned by others, there has to be consistency between your Java version and gradle version according to Gradle Official Compatibility Matrix.
Please, verify it with following commands:
java -version
gradle -version
I think this process / solution can be applicable in general. Hope it helps!

NDK version is UNKNOWN message after updating to Android Studio 3.5 [duplicate]

After updating Android Studio and Gradle to 3.5,
I now get this error:
NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN
I changed the Gradle version in build-gradle back to 3.4.2 but it didn't help.
I had similar problem and solved it by opening project using Import project (Gradle, Eclipse, etc.) instead of Open existing Android Studio project.
You can download NDK from File>Project Structur>Choosing SDK location from left panel and pressing Download from NDK location part.
I was having the same issue after upgrading my android studio. You just need to open local.properties & change ndk.dir path to your NDK path.
Code:
ndk.dir=D\:\\Android\\SDK\\ndk-bundle
sdk.dir=D\:\\Android\\SDK
I don't use NDK in my project, but I had the same problem. The problem disappeared after I updated the SDK version to the newest
compileSdkVersion 29
I had a previous answer (since deleted by moderators) where I detailed that there are workarounds (as listed here) that work for some but that there is an underlying bug in gradle because the workarounds don't work for everyone (specifically: none of them work for me)
The related google issue is here: https://issuetracker.google.com/issues/140403764
Update: As of today (20190920) they indicate that they have fixed the underlying issue, so I would expect a future release of gradle after today (20190920) will contain the fix.
Update2: Today (20190926) I received a response from a googler that the problematic code was in Android Studio and it is contained on the 3.6-release branch but is not available on any publicly available build at the moment (Android Studio 3.6 Canary 12 was released just before this fix was made). That lets you know which component to update and which versions to pay attention to, anyway. Looks like Android Studio 3.6 Canary 13 and later should have it https://issuetracker.google.com/issues/140403764#comment13
Until then you can try the workarounds but when there's a vendor bug and workarounds don't work you just have to wait for a vendor patch.
You need to install NDK using the SDK manager
I first got this issue after upgrading from Android Studio 3.5.0 to 3.5.1 today.
I simply did a rebuild from the top menu Build --> Rebuild Project.
This might not work for everyone depending on what caused the issue but it worked for mine. Give it a shot.
(Also, I do not use the NDK and never have downloaded it before. Still don't have it downloaded)
If you are not using NDK, ignore the error.
I have installed NDK to see if this makes any difference. There is no difference (except for an unused NDK folder of more than 2 GB :). So I removed it (i.e. delete the ndk folder and remove NDK environnent variable you have set previously).
After my recent Android Studio upgrade I had the same error message. I tried the other answers here and none worked. But #Zahra's answer pointed me to something that did work:
Go to File->Project Structure...
Under "Android NDK Location", click the dropdown and select the "DEFAULT NDK Recommended" option.
There was a slightly different path in there before I selected the default. Somewhere upgrading using the SDK manager, the path seems to have changed.
And now in the local.properties file sdk.dir is set to the same directory as the "DEFAULT NDK Recommended" option.
i fix it by going to file > Invalidate Caches\Restart
the IDE will restart and the problem will fix
I had same problem. My environment is:
Android Studio 3.5.1
Gradle 4.4
Android-Gradle-Plugin 3.1.2
CMake 3.10 and 3.6
I uninstalled CMake 3.10 by SDKManager. (installed CMake is 3.6 only)
Gradle sync and build succeeded.
(1)
android-gradle-plugin 3.1.2 used CMake 3.10.
In android-gradle-plugin 3.1.2 (or 3.1.+), feature of support for CMake 3.7 and higher is a preview feature.
(from output message of gradle assembleDebug or gradle sync.)
(2)
https://developer.android.com/studio/projects/add-native-code.html#use_a_custom_cmake_version
The SDK Manager includes the 3.6.0 forked version of CMake and version 3.10.2. Projects that don't set a specific CMake version in build.gradle are built with CMake 3.6.0.
Perhaps this behavior is android-gradle-plugin 3.3 or higher.
(it is from android-studio 3.3 that can be downloaded CMake 3.10)
android-gradle-plugin 3.1.2 used latest version from installed CMake.
I had the same issue on a mac as well.
Suggestion: Force the .gradle folder to rebuild itself..
This still shows the 'NDK Version is UNKNOWN' in the Event Log yet it builds successfully and doesn't give me any issues. (I don't have NDK downloaded)
Open your /Users/macuser/ folder
Press CMD + SHIFT + . (dot/period) to view hidden folders
DELETE .gradle folder
Restart Android Studio
This will cause Android Studio to rebuild and re-download your .gradle folder fixing your conflicting files in the process.
The problem is solved when I updated the Android Gradle Plugin Version from 3.1.4 to 3.4.0 and the Gradle Version from 4.4 to 5.1.1 at the same time. Of course, I downloaded the newest NDK(Side by Side) with SDK manager.
In my case, Android Studio was installed on a new mac. Just needed to download Android 9 (my target/compile SDK was 28) and build tools. The problem was solved after this.
In my case i fix it by upgrade to SdkVersion 29 and migrate to AndroidX.
After upgrading I've got the very same problem in one of my projects.
I solved it just deleting the line ndk.dir=D:\Android\SDK\ndk-bundle from the local.properties file.
I had the same error after adding a couple of libraries in the app-level build.gradle file.
The solution was just to clean the project.
In the menu bar choose: Build >> Clean Project
After that, the error was gone for me. I didn't do anything else.
I got this error (and several others) after importing a project from version control via Bitbucket hyperlink.
Once imported, close the project and re-import it using File > New > Import Project. After that everything built correctly.
(The NDK path was already specified properly, and only importing as new worked)
Meta:
Android Studio 3.5
Build #AI-191.8026.42.35.5791312, built on August 8, 2019
JRE: 1.8.0_202-release-1483-b49-5587405 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
Gradle 3.4.0
Problem solved for me after checking Suggestions in Project structure and updated the two suggested updates. Sorry I can't remember the module names as they disappeared as soon as I pressed update for each of them and graddle sync. started automatically and after this problem disappeared
downgrading ndk version from 20 to r17c and cmake version from 3.10 to 3.6.411459 solved the problem for me
I had the same problem after updating Android Studio.
My problem is solved by after updating Android SDK Build-Tools.
[Tools->SDK Manager->SDK Tools->Android SDK Build-Tools].
Then try to Clean the project
[Build->Clean Project].
Finally restart the Android Studio IDE......
I just closed project, closed android studio, restarted my PC, tracked my project and deleted the .Idea folder in "B:/PROJECTNAME/.idea" and voila.
Problem solved. It resyncs. N/B: my gradle is androidx. goodluck to someone.
Change the claaspath to 'com.android.tools.build:gradle:3.5.2' in build.gradle script
Ok. I recently downloaded the latest version of Android studio and got similar error. So eventually I created a new project.
Selected Kotlin Language then Jelly Bean (talking 'bout the options to pick from).
Then the whole synching began but the 1st sync failed and eventually it auto-synced again and everything began to work.
Did modify the default codes (text) since I'm a beginner but got no error messages.
The preview was OK and I continued my learning.
Sorry I couldn't explain it better. I'm just a beginner.
Oh! You need to be connected to the Internet for it to work.
If this problem occurred after an Android Studio upgrade and you initiated a plugin update from right bottom notification: Open File > Project structure, then change the Android Gradle version to your Android Studio version and downgrade the Gradle version to the previous one.
In my case, I downgraded the Android Gradle plugin from 3.5.3 to 3.2.1 and the Gradle version from 5.4.1 to 4.6.
I modified the gradle version of the gradle-wrapper.properties file from 4.1 to 4.6.
I had this problem and none of the solutions worked for me. Problem is, this error or warning might appear for very broad reasons. You can follow these steps to find out what is wrong:
NDK is missing
When Gradle starts to compile native dependencies it creates ".cxx" folder in your "app" folder. inside that folder you can find "ndk_locator_record.json" file, which is very strange type of log file. It is basically all the paths Gradle checks to find NDK folder. If there is any error or mismatch on NDK version numbers you can see in this file.
NDK build fails
for some unknown reasons (maybe bug in Gradle) ndk build does not show actual error on event log window, instead it shows a failure, like Gradle sync failed: executing external native build for ndkBuild .... following by NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN.
In this case go back to .cxx > ndkBuild > debug > x86(x64 or any other cpu arch)
Here in this folder you can find "json_generation_record.json" file, it is same type of log, usually last entry has the actual error. For example, for me was
../../sdk/native/jni/OpenCV.mk: No such file or directory
make: *** No rule to make target '../../sdk/native/jni/OpenCV.mk'. Stop.
From here you have a starting point to find out what is going wrong under hood.
If the NDK is not install, and the Android Project requires it then first install the NDK.
On windows OS add the NDK path to PATH environment variable. This will fix the version issue.
In my case the NDK path is
C:\Users\\AppData\Local\Android\Sdk\ndk\21.0.6113669
I faced this issue before and I fixed it by making sure to have the right permissions to the app directory.
I am using macOS, so I did:
chmod -R 777 your_android_project
and the issue was gone.
i have this problem too when I updated the Android Gradle Plugin Version from 3.1.2 to 3.5.1
Here is how to solve this issue :
Go to gradle.properties file in root folder of your project and add android.useDeprecatedNdk=true

Ionic trouble: can't build to android

I've got an Ionic 3.4 project and trying to build it to Android for testing purposes.
I installed Android Studio and the Android SDK, aswell Java 8. Then did:
ionic cordova platform add android
Then, when I write...
ionic build android
... I get the following error:
cordova build android ✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit
code 1):
ANDROID_HOME=C:\Users\Zerok\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_121
Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
What's going on? I also installed Gradle 4.0 into the Java folder, and pointed towards it in the GRADLE_HOME environment variable:
Var name: GRADLE_HOME
Value: C:\Program Files\Java\gradle-4.0
Also added the following to the path:
GRADLE_HOME\bin
But it still throws the same error... I don't think it's a problem with plugins, but with the Ionic/Cordova build system. What I don't understand, is why it needs Gradle when it's perfectly working in Android Studio, maybe it's because it's not in C:/, but a different disk? Any ideas?
(Assuming Windows 10)
open Start Menu, type path and hit Enter
System Properties will open. On the bottom click Environment Variables...
In the window that opens, on the bottom section named System Variables, double click Path
Click New and copy paste the path to your gradle installation
Make sure the path environment variable points to the bin folder of gradle like so: export PATH="$PATH:/home/jeffbl/android-studio/gradle/gradle-3.2/bi‌​n".
If that doesn't work try:
$ cordova platform rm android && cordova platform add https://github.com/apache/cordova-android && cordova build
If that doesn't work then use the SDK manager to downgrade to an earlier version of your SDK. It might be that there is no graddle wrapper out yet for the latest.
In any case you will find the answer to your problem in this github issue.
Ok, I already fixed it. And the fix is weird as hell, but well, at least it works.
Solution: uninstall Android Studio and install it in the main drive (C in my case). Everything began to work perfectly after this clean install.

NativeScript Installation Issues

I was just trying to install NavtiveScript, for this I followed the official installation guide available at
http://docs.nativescript.org/angular/start/quick-setup but I am stuck at "Step 3: Install iOS and Android requirements"
When I run the below command in Command Prompt (with administrative privileges)
#powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
Everything seems to be installed without any issue. But when I try to verify the installation through command, "tns doctor" I returns below warnings:
D:\>tns doctor
WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to build your projects for Android and run them in the native emulator.
To be able to build for Android and run apps in the native emulator, verify that you have
installed the latest Android SDK and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later.
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ android to manage your Android SDK versions.
You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=24'.
Run android from your command-line to install required Android Build Tools.
You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ android to manage the Android Support Repository.
Can anyone please guide?
I am using Windows 10, and have Visual Studio 2015 (update 3) and Visual Studio Code installed on my machine.
The command line of installing Android also didn't work for me and gave me the same errors as you. I figured out this by downloading and installing Android Studio. After your installation, you should be able to find the location of the android sdk, which is /Users/myMacUserName/Library/Android/sdk in my situation. And you could select all the needed things through SDK Manager. In the terminal, you then do 'export ANDROID_HOME=/Users/myMacUserName/Library/Android/sdk' instead of the command from NativeScript installtion instruction 'export ANDROID_HOME=/usr/local/opt/android-sdk'. After all these, you should be okay with the Android SDK errors.
https://developer.android.com/studio/index.html
Install the android studio from the above link and then after that run the studio and install the desired android sdk packages from within the studio.

Appcelerator on Windows 10, module build issues [duplicate]

I have create a new Mobile Module Project, but when i try to build it, i have this error:
BUILD FAILED
C:\ProgramData\Titanium\mobilesdk\win32\5.2.2.GA\module\android\build.xml:165:
no executable specified
Did something wrong? I did the following step:
-Installed Appcelerator Studio
-It automatically installed Titanium SDK and i selected to install Android SDK
-Installed JAVA JDK
-Createed new module and tryed to build it
To fix this, edit the file:
C:\ProgramData\Titanium\mobilesdk\win32\5.2.2.GA\module\android\build.xml
Or for any newer SDK versions, just use e.g. 5.3.1 instead of 5.2.2
On line 159, add ".exe" to aidl, like so:
TO
To develop android module you will have to install some additional component and configure some path variables. There is a nice quick start guide where you will find everything. Thinks that need to install:
Android NDK
Ant
Eclipse Java Development Tools plugin
Android Development Tools plugin
gperf
Python
Documentation Link

Resources