failed to find target with hash string 'android-22' - android

I have updated android studio with latest version and then after googling I also updated Android SDK with API 18 but still it gives the same error.

Just click on the link written in the error:
Open Android SDK Manager
and it will show you the dialogs that will help you to install the required sdk for your project.

Open the Android SDK Manager and Update with latest :
Android SDK Tools
Android SDK Build Tools
Then Sync ,Re-Build and Restart Your Project
Demo Code for build.gradle
compileSdkVersion 21 // Now 23
buildToolsVersion '21.1.2' //Now 23.0.1
defaultConfig
{
minSdkVersion 15
targetSdkVersion 19
}
Hope this helps .

Okay you must try this guys it works for me:
Open SDK Manager and Install SDK build tools 22.0.1
Sync gradle That'all

I modified build.gradle compileSdkVersion to 23 from 22 and targetSdkVersion to 23 from 22.
My API level was 23. I had to update the API version to 23 as well.
I had to import my project from Eclipse to Android Studio. It worked for me.

I had similar issue. I updated android studio build tools and my project didn't find "android-22". I looked in android sdk manager and it was installed.
To fix this issue I uninstalled "android-22" and installed again.

I created a new Cordova project, which created with latest android target android level 23. when i run it works. if i changed desire android target value from 23 to 22. and refresh the Gradle build from the Andoid Studio. now it's fail when i run it. i got the following build error.
project-android /CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java
Error:(217, 22) error: cannot find symbol method requestPermissions(String[],int)
I changed the target level in these files.
project.properties
AndroidManifest.xml
and inside CordovaLib folder.
project.properties
However, i also have another project which is using the android target level 22, whenever i run that project, it runs. Now my question is can we specify the desire android level at the time of creating the project?

I think you should install API 18 from android sdk if not already installed, otherwise you can try "invalidate caches and restart" (Find: File->invalidate caches and restart).

Change
compileSdkVersion 18
minSdkVersion 10
targetSdkVersion 18
in build.gradle in your app directory/module
Or Download Latest API Version

In sdk Manager download android 5.1.1, it worked for me

Open project.properties file and change the line with target=android-22 to the desired value.
For example:
target=android-19

Related

How to change default sdk version in Android Studio in windows OS

Whenever I create sample for eg:login template in android studio the project is getting created in android sdk version 23, I want to change this for all projects created in future.How to change the sdk version of android studio. Changing gradle settings after creation of project wont help since all the UI elements will be created for sdk23.Please suggest a solution.
You can change it from
your module level build.gradle file
compileSdkVersion 23
minSdkVersion 15
targetSdkVersion 23
change these values and rebuild your code.

Android version downgrade

Please I am trying to build a small android app with ionic but I downloaded android SDK 5.1.1 .
I wish to deploy to a device that has android version 2.3.3 but it won't even build .
It keeps telling me that the target app is android-22. I want it to build for a lower version like android-8.
Please any help will really be appreciated.
I only want it to be able to build for a lower version
I tried to edit the version in the androidManifest.xml files on my project but still I get errors
->First of all, let`s make sure you have downloaded the plateform for Android 2.2 using Android SDK Manager.
->Set android:minSdkVersion to 8 in androidManifest.xml
->Verify the BuidTarget attribute, since it specifies the development tool of which api to provide you.
->Your problem seems to be the absence of API8 in your SDK.
you might need to change your minSdk in build.gradle
in the app build.gradle file set the min sdk version as 8.
defaultConfig {
applicationId "com.etrade.mobilepro.activity"
minSdkVersion 8
versionCode 87
versionName "4.5"
}
Since the app is not building I guess you don't have that particular sdk.I would suggest downloading the sdk through sdk manager.

Android Studio build error for new project

I have uninstalled and reinstalled the Android Studio and when i created a new project I got the error stating files under build cannot be changed.Is this a problem with Gradle?.
Update your SDK, i.e. Marshmallow (API level 23). Then, choose targetSdkVersion to 23 and compileSdkVersion to 23. Finally, rebuild your project through Build > Rebuild project.

AndroidStudio: Failed to sync Install build tools

Going crazy with this error from about a couple of hours.
The error is:
failed to find Build Tools revision 23.0.0 rc1
But I think to have all update (also the release candidate!)
This is the image: thank you.
Go to File > Project Structure > Select Module > Properties you will landing to this screen
Select Build Tools Version same as version selected in Compile Sdk Version.
Hope this will resolve your issue.
I could fix it by changing it to
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
}
in build.gradle file
I had the same issue, with Build Tools revision 24.0.0-rc4. The fix was to install the package using the command line.
~/Android/Sdk| ls -1 build-tools/
23.0.3
24.0.0-rc4
~/Android/Sdk| ./tools/android list sdk -a | grep "SDK Build-tools"
4- Android SDK Build-tools, revision 24 rc4
5- Android SDK Build-tools, revision 23.0.3
6- Android SDK Build-tools, revision 23.0.2
7- Android SDK Build-tools, revision 23.0.1
8- Android SDK Build-tools, revision 23 (Obsolete)
...
~/Android/Sdk| ./tools/android update sdk -a -u -t 4
...
~/Android/Sdk| ls -1 build-tools/
23.0.3
24.0.0-preview
24.0.0-rc4
(note that 4 in the android update sdk command above refers to the preceding list's number for the desired version, found at the beginning of the line).
The directory build-tools/24.0.0-rc4/ had been created when I installed the package from Android Studio's SDK Manager. The above method created build-tools/24.0.0-preview/.
My app-level build.gradle script uses the -rc4 version, as specified in the setup guide:
android {
compileSdkVersion 'android-N'
buildToolsVersion '24.0.0-rc4'
}
I do not understand the correlation between -rc4 and -preview or why specifying 24.0.0-rc4 picks up the -preview package, but it did fix the issue for me.
I have the same problem.
i have solved this issue by the following point.
First one is go to inside build.gradle app file and change this
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc2"
}
with this one
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
}
I hope this will solve your issue.
I had the same problem and fixed it by going to File->Project Structure->Project and changing the Android Plugin Version to 1.3.0-beta1
Hope this helps!
I faced the same issue today,
And solved it easily by following points
1) Start the StandAlone SDK manager (To open the standalone sdk manager - Tools>Android>SDKManager> at Bottom YOu will see a link to launch StandAlone SDK manager)
2) Delete tha package of SDK Build Tools that you have already installed for e.g 24.0.0 rc4.
3) Close the standalone SDK manager then Restart Android Studio.
4) Once after restart the gradle will start building the project and you will get an alert download the package of SDK build tool and Sync. CLick on that and you will start downloading like that...
I hope this helps
I had the same problem, in my cases this happened because I changed the time on my computer to load .apk on google play. I spent a few hours to fix "this" problem until I remembered and changed the time back.
One of the answers ask you to use buildToolsVersion 23.0.0, but you would get buildToolsVersion 23.0.0 has serious bugs use buildToolsVersion 23.0.3. I did that then I started getting message buildToolsVersion 23.0.3 is too low from project app update to buildToolsVersion 25.0.0 and sync again. So I did that and it worked , So here are the final changes.
Inside app's build.gradle change this
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc2"
}
with this one
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
}
based on your screenshot I can see you have BuildTools ver 23.0.0 rc2 installed. So to get it right open up your gradle build file "build.gradle(Module:app)" and edit buildToolsVersion part like that:
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc2"
}
In case you have multiple SDKs locations (might happen if you play around with multiple Android Studio versions and create new location for SDK, what I did), make sure to check the local.properties file (both of the project and of your module, if you have such structure) and check if the line sdk.dir=/home/yourSdkLocation points indeed to the SDK you want to use.
This was the reason it wasn't working for me and it has fixed this.
There may be some file access permission/restriction problems. First check to access the below directory manually, check whether your TARGET_VERSION exists, Then check the android sdk manager.
sdk/build-tools/{TARGET_VERSION}
Had the same problem. I my case the build.gradel(app) was missing buildToolsVersion "27.0.0". So I open a previously working project to determine the version and added this line buildToolsVersion "27.0.0". Now it works fine.
Hope this helps.
I was also facing the same problem with gradle. Now I have solved by installing the highlighted in red. To navigate on this page Open Android studio > Tool > Android > SDK Manager > Appearance & Behavior > System Settings > Android SDK > SDK Tools (from tab options) > Show Package details(check box on the right bottom corner). After installing these just refresh the gradle everything will be resolved.
In case you have error regarding 'SDK build-tools failed' while installing Android Studio, Then you can Download build-tools from - https://androidsdkmanager.azurewebsites.net/Buildtools
Go to File > Project Structure > Select Module > Properties
After that CLICK on your project which will shown in LEFT PANEL
Then Select Properties
Change Build Tool Version to 22.0.1
It works for sure
problem:
Error:failed to find Build Tools revision 23.0.0 rc2
solution:
File > Project Structure > click on Modules > Properties
Change Build Tool Version to 23.0.1
its work for me
enter image description here
Start the project structure( file>structure)
You can see:
on the left, modules list;
on the right, Properties>Build Tools Version
there maybe are more than one modules.
change "Build Tools Version" for every Module.
it works.

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