When I run cordova requirements my Mac tells me I don't have any android targets installed, yet Android Studio tells me I have.
I have set JAVA_HOME and ANDROID_HOME as below in .bash_profile:
export JAVA_HOME=/usr/libexec/java_home
export ANDROID_HOME=/Users/darrensweeney/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/emulator
Yet when I run cordova requirements I see the following:
Am I missing a step?
I have also tried removing and re-adding the Android platform within Cordova, no difference.
Update:
Android Studio was throwing an error Please select Android SDK which I fixed by syncing with Gradle.
Now cordova requirements shows the following:
How can I make it see that android-30 is installed?
After a couple of hours digging, there's a better way to do this:
Install the android-sdk library:
brew install --cask android-sdk
This then allows you to use the sdkmanager to add any platform:
sdkmanager "platforms;android-30"
Related
How can I create a new AVD emulator for Mac OS.
I don't have Android Studio installed - would prefer not to.
Docs talk about a program avdmanager -but I don't have it.
I think that gets installed with a certain Android sdk tools version - but I'm not getting the option to upgrade in my sdkmanager
+1 on comment of Liberbon
just change the x86 to x86_64 if you are using 64 bit OS.
In my case this solved my issue, I am using Mac OS v10.14.6
Install the dependencies for Android development.
Make sure that these initial steps are done before you create AVD emulator.
# Install Java 8 and Android SDK
brew tap caskroom/versions
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
brew cask install android-sdk
# Set environment variables
echo "export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)" >> ~/.bash_profile
echo "export ANDROID_HOME=/usr/local/share/android-sdk" >> ~/.bash_profile
source ~/.bash_profile
# Install all Android SDK packages
$ANDROID_HOME/tools/bin/sdkmanager "tools" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository"
Create Android Virtual Device via command line.
# Load image if it's missing (optional)
$ANDROID_HOME/tools/bin/sdkmanager "system-images;android-28;google_apis;x86_64"
# Create android emulator with avdmanager
$ANDROID_HOME/tools/bin/avdmanager create avd -n Emulator-Api28-Google -k "system-images;android-28;google_apis;x86_64"
References:
https://docs.nativescript.org/start/ns-setup-os-x
https://docs.nativescript.org/tooling/android-virtual-devices#creating-android-virtual-device-via-command-line-tool
UPD:
2020-05-21: Changed brew cask install java8 to brew cask install adoptopenjdk/openjdk/adoptopenjdk8.
2020-05-21: Changed x86 to x86_64. Thanks #Bon Tobiel Blancia for advice.
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/bin".
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.
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.
I am trying to install the ruboto gem on my MBP retina. I have previously installed the SDK and NDK on my computer using Homebrew as the install service and have them pathed as such. However, here is my problem.
When trying to use 'ruboto setup', the system keeps informing me that is cannot find
"Platform SDK android-19". I have added the path to the platform/android-19 folder in the .bash_profile, however it refuses to see it as such. Any hints as to how I might correct this or work around this?
"ruboto setup" expects the platform sdks to be installed in a directory parallel to the "android" command:
<android-sdk>/tools/android
<android-sdk>/platforms/android-19
You need to ensure that your Android SDK installation follows this structure or file an issue in the Ruboto tracker ( https://github.com/ruboto/ruboto/issues ) and ask for "ruboto setup" to support Android SDK installation using HomeBrew.
An alternative is to uninstall your Android SDK and let "ruboto setup" install it from scratch.
my mac os is the latest version , i install libevent in the following steps:
cd directory
./configure && make
sudo make install
and install successfully.
but in my Xcode the file not found, can someone help me?
You have to set your project setting correctly (xcode is a pain in the butt). My "Header Search Paths" is set to $(SRCROOT)/../../../libevent (non-recursive). Seriously... this took almost an hour to configure properly. Much easier in Visual Studio which has navigation tools.