gradle in android studio is not selecting the installed sdk - android

I have started learning android and i'm stuck at something.
I have installed android sdk api 22 and when i'm syncing it with gradle , the following error is popping up:
Failed to find target with hash string 'android-27' in: C:\Users\user
\AppData\Local\Android\android-sdk
it says that it is missing android sdk api 27 but i have installed android sdk api 22
why is it not selecting the installed sdk

1.>Uninstall your android studio. remove all folders. and sdk from c drive.just remove all file folder related to android studio.
2.>Download latest android studio from android developer site using below link.
https://developer.android.com/studio/?gclid=CjwKCAiAyrXiBRAjEiwATI95mQYBGcmv_eUPnDUijy-THzdWA_dIIc-6iM1CEZ0w-k02TxfN4wqbXBoCTAYQAvD_BwE
3.Install android studio from downloaded .exe file.
will work fine if android studio will install successfully.
android studio don't need sdk externally.

Check the app/build.gradle file, maybe you specified sdk version 27 on it, you can change it with api 22.

Related

Could not find android.jar for API Level 26 in Visual Studio 2017

Could not find android.jar for API Level 26. This means the Android
SDK platform for API Level 26 is not installed. Either install it in
the Android SDK Manager (Tools > Open Android SDK Manager...), or
change your Xamarin.Android project to target an API version that is
installed. (C:\Program Files
(x86)\Android\android-sdk\platforms\android-O\android.jar missing.)
As you can see from below that I have the correct api sdk platforms installed but as you will notice on the error message, it is searching for an android-O directory.
Here is my directory which you will notice has everything in it but doesn't contain android-O
I looked in my visual studio project settings and here is what it shows for target framework
Does this mean that Visual Studio 2017 doesn't support Android SDK 26+?
I discovered that you can fix this issue with 2 steps:
Download and install Visual Studio 2017 Preview by going to https://www.visualstudio.com/vs/preview/
Download and install the Xamarin update extension on both versions of Visual Studio 2017 installed by going to https://developer.xamarin.com/recipes/cross-platform/ide/change_updates_channel/extension-gallery/ and follow the steps
If you're building for a Xamarin project, you may need to rename the folder in the SDK folder from "android-{alphabetOSVersion}" to "android-{numericOSVersion}" (IE change the folder "android-o" to "android-27").
This should be done in the C:\Program Files (x86)\Android\android-sdk\platforms folder.
I was getting a similar issue.
Severity Code Description Project File Line Suppression State
Error Could not find android.jar for API level 29. This means the
Android SDK platform for API level 29 is not installed. Either install
it in the Android SDK Manager (Tools > Android > Android SDK
Manager...), or change the Xamarin.Android project to target an API
version that is installed. (C:\Program Files
(x86)\Android\android-sdk\platforms\android-29\android.jar missing.)
The easy fix was to follow the steps mentioned in the error itself from your Visual Studio (I was using Visual Studio 2019).
Click on the Apply Changes button and then reload the project.
MVS 2017 does support Android SDK 26+,
Im using it with v15.3.3.
If you have MVS 2017 installed on your machine,make sure it's up to date
then download and install the Xamarin update extension.
Check out this guide
https://developer.xamarin.com/recipes/cross-platform/ide/change_updates_channel/extension-gallery/
And as a rule of thumb,whenever you get the error "Resolve the “Could not find android.jar for API Level XX” in Xamarin Studio" this are steps to follow to solve such an error
This happens when you target your project to a non-installed Android SDK platform, to fix this you have to install the right components.
Step 1:Target another Android Framework
On the project you have created right-click the project > Options
Go to the Xamarin project configurations
Then go to Build > General > Target framework, and select other Android target framework.
Xamarin project Android target framework
Step 2:Install the Android SDK you need
As the second option you can install the missing components needed to debug on the SDK Android platform; for this you have to go to:
Tools > Open Android SDK Manager
Android SDK Manager Option
Then look at the API Level number on the error or look at the version of the target framework as stated at the previous steps; then select to install the “SDK Platform” and press the “Install 1 package” button.
Choose the right Android SDK Platform
Accept license agreements
license agreements
With this you are ready, press F5 and you can debug now.

After reinstall Android Studio--Failed to find target with hash string 'android-23'

I uninstalled Android 1.4, and then installed Android 1.3 with API 15. When I run the project, it has following errors.
I want to use the old version of Android Studio (1.3), it seems that I have to install the latest version.
click on android sdk manager icon
click on android sdk
in the android sdk location give link to your sdk
it will look somthing like C:\Users\......\AppData\Local\Android\sdk

Object reference not set to an instance of an object When I create new Android App (Visual Studio)

In a Visual Studio 2015, Xamarin, Android SDK, jdk 1.7, and emulator are installed and Xamarin has all green checked items in tools>options>Xamarin. But When I try to create Blank App (Android) VS shows an error:
Object reference not set to an instance of an object
Then new project fail to create and solution explorer will be empty.
How could I solve it?
I solved it with updated Android SDK setup (API Level 19 and 21) [3rd party] to Android SDK setup (API Level 22) [3rd party] in Visual Studio setup.
I had the same problem and when I installed Android 4.4.2(API 19) from
Android SDK Manager the issue got resolved. You can open Android SDK Manager in
VS2015 with Update 2 by navigating to Tools-> Android->Android SDK Manager
I figured out this...
Depending on the emulators you want to use with the new project, subject to what is installed using Android AVD, you will need to download the necessary API Level.
Example.
I looked up my emulators.
Then I simply opened Android SDK Manager and downloaded the corresponding API Level 19
And everything worked out well
I also encounter this problem on Visual Studio 2015 Update 2 with Xamarin.VisualStudio_4.0.3.214, but I solved it by installing level 19, 21, 22, 23 through Android SDK Manager.
I struggle with this same problem for a whole day but I got it resolved after several iterations.
Make sure Android Studio is not installed on your computer. If it is, uninstall it and run the VS2015 installer again until all Android SDK errors go away.
Make sure VS2015 is closed and install the most recent stable version of Xamarin for Visual Studio 2015. I found it here: https://store.xamarin.com/account/my/subscription/downloads. (Trying to install it through VS2015 didn't work for me under Tools -> Android -> Settings -> Xamarin for Visual Studio Updates.)
Make sure you have Java SDK version 7 installed on your machine (do not use 8 even though its the latest). You also must use the 32-bit version even if you have a 64-bit machine. This was key!
Install the Android SDK. Standalone version, not Android Studio + Android SDK.
Install the Android NDK.
Restart your computer and open VS2015. Go to Tools -> Android -> Settings and set the correct paths to Android SDK, NDK and Java SDK.
You should be good to go with creating a new project. You are all welcome!!!

"parseSdkContent failed Could not initialize class android.graphics.Typeface" in SDK Andorid 5.0

I'm getting the below error after I update the SDK Android 5.0 (API 21)
"parseSdkContent failed Could not initialize class android.graphics.Typeface"
Another thread suggested to delete .android folder, yes its works, but after sometime this error will trigger again and not able to select any Project Build Target SDK, (its allows to check the target and apply, but again open Properties->android, its showing unchecked) to build the app.
I'm using Android SDK Build Tools Rev 19.1 and Eclipse Juno. ADT version 23.0.4
Note : If my Android Project target SDK version is 20 or 19, there is no problem.
This is android package error,its corrupted android 5.0 sdk platform. Just Delete the folder <sdk>/<platforms>/<android-21> and download the android 5.0 sdk platform from sdk manager.
Got the fix. This happened because you installed a new Eclipse and loaded the 5.0 API Directly. You just have to delete the file:
".android in C:\User\\" in Windows.
After this step just install the ANDROID SDK BUILD-TOOLS revision 21
Hope it works for you :)

Import of Eclipse project into Android Studio using build.gradle file fails

I'm trying to import my Eclipse based Android project using the build.gradle file. I get the following message: "failed to find Build Tools revision 18.0.0". However, according to the Android SDK Manager, I have Android SDK Build-tools 18.0.1 installed.
I am doing all this on a 64-bit Windows 7 machine, if that's relevant.
How do I fix this?
UPDATE: I actually only updated to Build-tools 18.0.1 this morning. I then noticed that, when making a new project in Android Studio, it wouldn't allow me to create a project using Android 4.3 (4.2.2 was the latest allowable version). I tried dropping the target version of my project to Android 4.2.2, and re-exporting it. Now Android Studio complains about not being able to find Build-tools 18.0.1 when I try to import this project.
I was an Android Studio virgin too up until 10 minutes ago. I ran into the same problem. If you check your SDK Manager in Android Studio (or Eclipse I believe) it will show which tools you have installed. I am/was missing build tools 18.0.1 too and getting the error....but it was because I hadn't installed them.
So without modifying the Gradle build files, I was able to install the build tools using the SDK Manager and get everything up and running.
See this image:
As an aside, I also had to update the API version as well because it selected an API version that wasn't installed (which I don't get because it was when I compiled with Eclipse).
Hope this helps.
This did the trick for me.
In build.gradle file inside the main module modify the line
buildToolsVersion "18.0.0"
to
buildToolsVersion "18.0.1"
I'm very new to Android Studio (as of last night). I encountered the same problem. I opened up the 'build.gradle' file and modified the lines with: "compileSdkVersion 18" and "buildToolsVersion 18.0.1" to 17 and 17.0.0 respectively. It seems to do the trick!
you must make sure the build.gradle file contains the same version of the installed build tools.
you can find this out by looking in the /sdk/build-tools/android-X.Y.Z/source.properties file under the Android Studio installation
e.g.
Pkg.UserSrc=false
Pkg.Revision=18.1.1
then plug that revision number into the gradle build file:
android {
compileSdkVersion 18
buildToolsVersion "18.1.1"
...
}
I had issues with Gradle too. A full delete and install the latest version fixed it.
I also had the same problem then I have checked my Enviornment Variable and it is pointing to my old sdk which does not have Build tool 18.0.x After pointing it to new sdk everything goes well.

Categories

Resources