When I make a new typescript Cordova application in Visual Studio, a page comes open with:
Please fix the following issues to ensure that your app builds and runs successfully.
Android SDK : The override value set on the Environment Variable Option Page pointed to an invalid or nonexistent location for this software.
When I run the app with ripple -Nexus (Galaxy), in error list I have 2 errors:
Please install Android targer " Android-19 "
cmd: Command failed with exit code 8
Does anyone have the answer?
You did not installed the SDK right!
click "Start" and look for "Android SDK Tools" - "SDK Manager", under "Tools", the following should be installed:
Android SDK Tools
Android SDK Platform Tools
Android SDK Build Tools for rev 19.1
Then install everything inside Android 4.4.2 (API 19)
If you cannot find SDK Manager, which means that you did not install Cordova correctly.
If you are using Visual Studio 2013 Community Update 4, you need to install Tools for Apache Cordova CTP3.1
If you are using Visual Studio 2015 Community RC, you need to select "Tools for Apache Cordova" during the installation of VS 2015.
If you are inside China or some other countries that block access to Google, you need to make sure you can access dl.google.com before you install Tools for Apache Cordova.
If you think that you install everything properly and still get the error, in Visual Studio, go to "Tools" - "Options" - "Tools for Apache Cordova" - "Environment Variables Override" and check the ADT_HOME variable, is your Android SDK installed in the path stated in the ADT_HOME?
Still not ok? in "Tools" - "Options" - "Tools for Apache Cordova", use "Clear Cordova Cache", then the system hangs about a minute or two, then it will ok, and you can rebuild again.
Related
I installed Android Studio Arctic Fox 2020.3.1 on Ubuntu via the Ubuntu Software Center having previously installed the Java and android SDK's using apt from a terminal, following the official installation instructions and I had no reported issues while installing or after. When I ran Android Studio, its seems to have detected the Android SDK location which is installed at:
/usr/lib/android-sdk
but when I tried to add additional platform and tools for android nougat in:
Tools->Android SDK->Android SDK Location
The Android SDK location is:
/usr/lib/android-sdk
Which is correct, but when I click Edit and the SDK Components Setup dialog is loaded, the Android SDK location is again displayed and is also correct, however there's a warning message underneath which states:
<!> An existing Android SDK was detected. The setup wizard will only download missing or outdated SDK components.
When that appears to be merely stating the obvious and doesn't need to be said, so why the warning?. I just ignored it anyway and tried to add some additional plaform support. Prior to that, to test android studio was working after install, I rebuilt an existing hello-world project and the target platform from previous builds was 27.0.1 and as a result of rebuiding that existing project Android Studio appears to have created a hard link from 27.0.1 which it installed to the 'debian' folder, so when I list that location in a terminal I get:
$ls -al /usr/lib/android-sdk/build-tools/
lrwxrwxrwx 1 root root 6 Aug 29 2019 27.0.1 -> debian
drwxr-xr-x 3 root root 4096 Aug 11 00:22 debian
As you can see '27.0.1' is a hard link to the debian folder and by checking the properties of the link I can confirm it was created by Android Studio on 11th August which is the date it was installed:
27.0.1 Properties
Name: 27.0.1
Type: Link to folder (inode/ directory)
Parent folder: /usr/lib/android-sdk/build-tools
Modified Wed 11 Aug 2021 12:22:55 BST
When I attempt to install any additional platforms and tools, Android Studio now complains and cannot continue, it tells me to check the log and when I examined the Idea.log it says:
'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')
when the expected location exists and there appears to be no such issue, since the Android SDK is exactly where the installer put it and exactly where it should be, I dont know why it thinks there is a problem, where there doesn't appear to be one. However I dont know why Android Studio created the hard link for platform 27.0.1 -> debian when it added that platform to build hello world?
I worked out the solution myself. The solution is:
(Note: you need to ensure your PC is connected to the internet, so Android Studio can download the Android SDK)
Uninstall the Android SDK.
In my case, I installed the Android SDK via apt in a terminal, so I uninstalled using the following commands:
sudo apt-get remove android-sdk
and then
sudo apt-get --purge remove android-sdk
Launch Android Studio and it will automatically start the Android Studio Setup Wizard and issue the pop-message:
Title: Missing Components
Message: No Android SDK found
Follow the wizard to install the SDK.
This time the SDK is installed to your home directory and Android Studio has no issues with the SDK.
To test it all works, I installed the additional build-tools and target platforms for my test app and built and ran it on an AVD and everything works fine.
I try to uninstal cordova then instal again but still not working
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.
It looks like you need to install your android SDK/build tools.
You can do it manually or using your android studio installation if exists.
To do it with Android Studio you can:
Go to settings->Appearance and Behavior->Android SDK
Go to the SDK Platforms tab and select the latest Android SDK
package.
Go to the SDK Toos tab and select the following checkboxes:
Android SDK Build-Tools
Android SDK Platform-Tools
Android SDK Tools
NDK
Android Support Repository
Google Repository
Apply and accept
To do it without using Android Studio there's an answered question here: How do I download the Android SDK without downloading Android Studio?
When I try to run a new blank Android app I get an error:
"The Android SDK Directory could not be found...".
I searched in google for a solution and I found out that I need to go to Tools -> Android -> Android SDK Manager, and then I realized the buttons are disabled.
I did some checks:
in Tools -> Options -> Android Setting for Android SDK Location and it's empty. Furthermore, the folder Programs Files(x86)\Android\android-sdk contain only 1 folder named extras
I did a VS repair, twice, and nothing changed.
As I understand the problem, I don't have SDK and somehow VS can't install it properly.
Is there any manual way to install it or any other solution?
Edit: I've tried to uninstall Visual Studio and install again. It couldn't install everything successfully, here is the log:
Package 'JavaJDKV2,version=1.8.6,chip=x64' failed to install.
Search URL
https://aka.ms/VSSetupErrorReports?q=PackageId=JavaJDKV2;PackageAction=Install;ReturnCode=-1
Details
Command executed: "C:\ProgramData\Microsoft\VisualStudio\Packages\JavaJDKV2,version=1.8.6,chip=x64\jdk-8u181-windows-x64.exe" /quiet
Return code: -1
Return code details: Unknown error (0xffffffff)
Log
C:\Users******\AppData\Local\Temp\dd_setup_20180828172213_290_JavaJDKV2.log
Impacted workloads
Mobile development with .NET (Microsoft.VisualStudio.Workload.NetCrossPlat,version=15.8.27906.1)
Impacted components
Android SDK setup (API level 27) (Component.Android.SDK27,version=15.8.27906.1)
Google Android Emulator (API Level 27) (Component.Google.Android.Emulator.API27,version=15.8.27906.1)
Java SE Development Kit (8.0.1120.15) (Component.JavaJDK,version=15.6.27406.0)
I fixed it and here is what worked for me:
I downloaded the Android Command line tools
I put the downloaded folder in C:\Program Files (x86)\Android\android-sdk
I opened CMD and directed to that folder.
I've checked the command sdkmanager --list, see sdkmanager page for more information
And I downloaded via the sdkmanager commands the SDKs I needed
Also, VS2017's SDK manager started to work as well after I downloaded what I needed from the command line.
download the latest version of "sdk-tools-windows-4333796.zip" in https://developer.android.com/studio this web site and update your visual studio to latest version
this will surely work because even in my case it was same error for 3days then i did these changes and now it works fine
Install Android studio - https://developer.android.com/studio
Open Android studio -> configure -> copy Android SDK location
Open Visual studio -> Tools -> Options -> Xamarin -> paste your SDK location
Done!
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.
I downloaded and installed SDK Tools for Windows (I'm using Windows 7 Professional - 64 bit and have Admin rights).
Setting Up an Existing IDE page explicitly instructs:
If you'll be using Eclipse, do not start the Android SDK Manager,
and instead move on to Installing the Eclipse Plugin.
I then followed Installing the Eclipse Plugin instructions. I was able to download the plug-in (steps 1 - 7). During installation I got the following errors:
Error: Missing platform-tools
[2014-01-20 20:26:59 - Android SDK] Error when loading the SDK:
Error: Missing platform-tools
[2014-01-20 20:27:18 - SDK Manager] [SDK Manager] Error: Missing platform-tools
These tools were actually preselected and would've been installed by SDK Manager, but as (shown above) we were told not to do so.
What do I do now to complete the installation. Do I install Platforms tools via SDK Manager? If so, do I unselect everything else?
I do not believe this case is covered in Troubleshooting ADT Installation section of the Android web-page.
Please point me into the right direction.
platform-tools used to be included in the SDK by default but for some reason Google removed it, and now you have to launch the SDK Manager first, and install the Android SDK Platform Tools.
You can go ahead and install other packages as well at this stage if you want, but all you have to install is the platform-tools. After that you can start eclipse again, go to Window--> Preferences --> Android and point it to the right location