How to change build tools version in Android Studio - android

I have a problem using jfeinstein10 Sliding Menu
I added the library into my root project folder. But I get this error :
Error:The SDK Build Tools revision (17.0.0) is too low for project
':SlidingMenu'. Minimum required is 19.1.0
But I'm already using "19.1.0" but it still says I'm using 17.0.0
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.repliklernet.replikler"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile group:'com.squareup.picasso', name:'picasso', version:'2.5.0'
compile project(':SlidingMenu')
}
What am I missing ?

If you look at the build.gradle file for the library, you can see that it references build tools 17: https://github.com/jfeinstein10/SlidingMenu/blob/master/library/build.gradle#L17
You need to update that line.
The error is actually giving you a hint by mentioning project ':SlidingMenu', referring to the project SlidingMenu.

Right click on the project folder and choose 'Open Module Setings'
Select 'app' on the Modules List(Left pane)
Select 'Properties' tab and will present you with 'Compile SDK Version', 'Build Tools Version'.
Click OK
Reference : https://www.youtube.com/watch?v=v4b7C6Q-9dI

You should change the build.gradle within your library

Related

Android Gradle build - dependencies Error

I use:
android studio 1.5.1
java version "1.7.0_80"
I want to create a new android project as
Min Api-version = 15
But android studio cannot create new application , a dialog is opened with this title :
"Building 'MyApplication' Gradle project info"
and its content is :
a text: "Gradle: Resolve dependencies ':app:_debugCompile'"
and a progressBar;
unfortunately this dialog is opened for long time,just now ...
I had some projects , but when I want to build gradle for them below error is shown to me :
Error:(3, 0) Gradle DSL method not found: 'android()'
Possible causes:The project 'e-project' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Fix plugin version and sync project
The project 'e-project' may be using a version of Gradle that does not contain the method.
openGradleSettings Gradle settings The build file may be missing a Gradle plugin.
"apply.gradle.plugin Apply Gradle plugin
Edit 1: I added build.gradle
apply plugin: 'application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.e_example.android.app"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
}

iTextPdf - Android Studio Adding Library Error

I want to add itext lib to my project.(http://itextpdf.com/itextg-android)
I added to jar file into libs folder. After that i wrote to build.gradle that : compile files('libs/itextg-5.5.4.jar') .
But after the sync , i am getting that error :
Error:(12, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'Pdf' may be using a version of Gradle that does not contain the method.
Gradle settingsThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Also here(http://www.codeproject.com/Articles/986574/Android-iText-Pdf-Example) is a solution about this but when i do that i am getting another error
Error:Failed to resolve: org.apache.commons:commons-imaging:1.0-SNAPSHOT
Open FileShow in Project Structure dialog
Please check if you added all needed packages and after this your buil.gradle looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.proyecto.alberto.monedero"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile files('libs/itextg-5.5.4.jar')
compile files('libs/itextg-5.5.4-sources.jar')
compile files('libs/itextg-5.5.4-javadoc.jar')
compile 'com.google.android.gms:play-services:7.0.0'
}
From: https://github.com/alonsoat/ProyectoMonedero/blob/master/app/build.gradle
Hope it help
You can also add a .jar or a library via right clicking on
"app" > New > Module
Then select the
Import .JAR/.AAR Package option.
You can click the "browse" [...] on the far right and locate your jar.
Sync the project right click app > Sync app
You should be golden after that.
Alt-Shift over RED methods/code relevant to your added library and you should now be able to quick import.
Just another option.

Unable to add Minim-Android library in Android Studio with jitpack

I am trying to add to my build.gradle file in Android Studio the following dependency:
https://android-arsenal.com/details/1/1883
I followed the intstructions found in package tab of this page, but when I tried to build the project I got the following message:
Error:(32, 13) Failed to resolve:
com.github.DASAR:Minim-Android:a73b596916
Anyone can help me?
I also tried to download the project code and import it in Android Studio as a module, but it wasn't recognized as a library from the wizard.
Thank you all in advance.
You can download relative API in your AS SDK Manager, then add it in build.gradle. After that, check out the compileSdkVersion, targetSdkVersion are same with appcompat. My build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.0.1"
defaultConfig {
applicationId "com.example.android"
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.0.0'
}
my sdk is 19
Best option is to fork the project and add a Gradle build file. Then use JitPack to build the fork.
Note that the project has dependencies in a libs/ folder so these would need to be converted to dependencies in Gradle.

Failed to find: com.android.support:support-v4:22.2.0

I am trying to do an application but there seems to be some error with the gradle files now. It was working fine until I upgraded the support libraries.
I was working with api 21 which worked fine, but then i upgraded to api22 and changed the gradle files accordingly.. Now this error shows up.
Error:Failed to find: com.android.support:support-v4:22.2.0
This is my current gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.sampleapp"
minSdkVersion 12
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.jakewharton:butterknife:6.1.0'
}
Any help would be appreciated.
If this might help someone, after MANY trials and errors, I found that I was targeting the wrong SDK version (an older one) in the build.gradle file corresponding to "library". To change this you can do it by hand or go to the Module Settings Menu (right click on your project folder -> Open Module Settings. Then in "library" - Properties you can change the Compile Sdk and the Build Tools Versions
Using Android SDK Manager. Go to Extras and then Android Support Repository and update it to the latest version.
(This is essentially the comment #natario made, but it should be an answer.)

Error in gradle sync(Android Studio)

I was trying to follow the instructions from Google developers in setting up Google play services:
https://developer.android.com/google/play-services/setup.html
And in the step 2, I copied this:
apply plugin: 'android'
...
dependencies {
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services:6.1.+'
}
in the gradle file, then I realized that that piece of code was already there, with the exception of the last line(...sevices:6.1.+'), I copied the compile 'com.google.android.gms:play-services:6.1.+' and placed where it belongs,now my gradle looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'theapp.application.developer.moreappinfo.seconpart'
minSdkVersion 7
targetSdkVersion 19
versionCode 3
versionName '1.2'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:appcompat-v7:20.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.1.+'
}
went to sync with gradle files and this error appears an I don't know how to fix it:
Error:
Failed to find: com.android.support:appcompat-v7:20.0.0
Error:Open in Project Structure dialog
Open File
You need to install the "Android Support Repository" in your SDK Manager.
Open your Android SDK Manager
Scroll down to the "extras" folder, and check the box next to "Android Support Repository"
Click "Install packages..." and accept all of the licenses that it asks you to accept.

Categories

Resources