Android Studio build error for new project - android

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.

Related

How to set the minimum SDK Build Tools version required in an Android Studio project?

When I try to run my React Native project in the Android emulator I get the following error:
The SDK Build Tools revision (23.0.1) is too low for project ':app'.
Minimum required is 25.0.0
My android/app/build.gradle file specifies:
buildToolsVersion "23.0.1"
On Android Studio, it also logs the same error for each of the packages I'm using:
I believe this started happening after I inadvertently updated some stuff that Android Studio suggested.
All the build.gradle files that I've checked specify version 23.0.1, but for some reason 25.0.0 seems to be overriding that setting.
How do I go about correcting this?
Ran into this issue and realized that the error is quite vague. Coming from an iOS background into React Native, I've had to learn a lot more about the Android ecosystem. The problem is that your project Gradle version is too high.
In your project's (top level) build.gradle you may be using:
classpath 'com.android.tools.build:gradle:2.3.1'
Gradle v2.3.1, implicitly sets the minimum SDK Build Tools revision to 25.0.0.
To fix, you can simply revert back to:
classpath 'com.android.tools.build:gradle:2.2.3'
This will allow your project's modules to use buildToolsVersions 23.0.1 or 25.0.2
Install required Build Tools version 25.0.0
Update buildToolsVersion in build.gradle file and sync project
Set compileSdkVersion 25 and targetSdkVersion 25
Clean and Build your project again
Finally, Run on device
Hope this will help~
May be you are updated your studio version and open your old project if you do that then you want to go to package explorer app and right click on it and open modual setting one window open then select the project and set the Gradle version
and android plugin version
example
My studio version is 2.3
then Gradle version = 3.3
and Android plugin version = 2.3.0
if you not find then create new project blank project and see the setting and apply on your project
Android SDK Build Tools are required to build Android apps (see https://developer.android.com/studio/command-line/index.html#tools-build). It's recommended to always use the latest version.
In your case react* libraries aren't compatible with current build tools version (23.0.1) so you need to upgrade (25.0.2 is the latest version at the moment).
The version is specified in build.gradle of your module. After syncing project everything would be fine or an error will be displayed that will suggest installing the missing version. Android Studio will do that for you.
android {
...
buildToolsVersion "25.0.2"
Uninstall all new-ones 'Android SDK Build-Tools' versions after comes 23.0.1 in SDK Manager and Sync and try again for that project only...

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.

How to downgrade project sdk from 23 to 21 in android studio 1.4.1 without getting error?

I just started install android studio this year and i get a default sdk of 23 everytime i open my project. However, i would like to downgrade it to sdk 21. But i have been getting error from other java file. How should i solve this matter? I have been following from this tutorial "Changing API level Android Studio". However after gradle sync, the error come out

Android Studio: Failed to sync Gradle project

Gradle sync failed: Cause: failed to find target with hash string 'android-18' in: C:\Users\Android\sdk Consult IDE log for more details
I am finding this error every time, when importing a project into android studio.
Go into the Android SDK manager and install the platform SDK for API 18. Or, go into the project settings and change the target API and build tools versions to be what you already have installed.
I am finding this error every time, when importing a project into android studio.
For addressing this issue, you may want to change SDK level of the imported project to whatever you'd like. (However you should mak sure your chosen SDK level meets features used by the library)
For this, you should open build.gradle file of that project and change SDK level there.
defaultConfig {
minSdkVersion 4
targetSdkVersion /* SDK LEVEL */
}
Another option would be installing SDK level 18 via SDK manager.
For handling this issue, you have to update the gradle version in build.gradle of your project to latest gradle version of your android studio. After that if android studio terminal shows any of the following then
1) install the missing platform(s)
or
2) install build tools
or
3) Fix Gradle wrapper and re-import project
do that and sync your project.

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

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

Categories

Resources