Error in gradle sync(Android Studio) - android

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.

Related

How to change build tools version in Android Studio

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

Failed to resolve: com.android.support:support-v4:23.0.0

After update with the latest Android support library 23.1 i get this error
Failed to resolve: com.android.support:support-v4:23.0.0
I tried all combination of 23.+ and 23.1.0 and 23.1.+ etc. How to make it run properly?
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ua.g.tfinder"
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.0.+'
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:design:23.0.+'
compile 'com.google.android.gms:play-services:7.5.+'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
The support libraries are now available through Google's Maven repository.
Step 1: Open the build.gradle file of your project.
Step 2: Make sure that the repositories section includes a maven section with the "https://maven.google.com" url in it.
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
I ran into the same problem today. Although the SDK Manager marked a few libraries as installed, investigating the location of the files showed me the correct folder structure, without any files in them.
For example, checking out the location of 23.1.0 appcompat-v7 on my Mac:
.../sdk/extras/android/m2repository/com/android/support/appcompat-v7
turned out to be an empty folder.
I suspect the update I ran minutes before went wrong somehow.
What solved it for me:
in Android Studio, open Appearance and Behaviour -> System Settings -> SDK Manager
under tab "SDK Tools" un-check the libraries causing problems
click "apply" to uninstall them
re-check the same libraries
click "apply" to reinstall them
close SDK Manager and run Gradle sync / build
Had to add "Android Support Repository" from SDK Manager.
As you already have v7 dependency added in your gradle file no need to add dependency for v4 because it is already included in v7 library.
gradle file should looks like this
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ua.guru.lvivflatfinder"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
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.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
}
.......
(build.gradle (MOdule.app)
implementation 'com.android.support:cardview-v7:28.0.0-rc01'
In my case, opening SDK manager and installing Local Maven Repository for Support Libraries fixed my issue.
Go to File -> Project Structure then select Dependencies tab and remove com.android.support:support-v4:23.0.0
It worked for me
Gradle sync / build
implementation 'com.android.support:cardview-v7:28.0.0-rc01'
ready and go!
I got a similar problem, was trying to change versions and so on. Did not work for me. Only after I changed the version and restarted Studio it started to work. Probably gradle doesn't sync that normaly while you don't restart Studio.
I got this error when I tried to build the app while being OFFLINE. After connecting to the internet it worked :-)
he support libraries are now available through Google's Maven repository.
Step 1: Open the build.gradle file of your project and add the following dependencies.
allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
jcenter()
google()
}

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.)

Android SDK and Facebook SDK - Failed to find build revision 4.0.1

I am currently trying to make Facebook SDK cooperate with my Android Studio. I've been following their step-by-step guide: https://developers.facebook.com/docs/android/getting-started (so far so good), but I am currently hitting a wall.
While trying to sync my project, I get following error: Failed to find Build Tools 4.0.1.
At this point I did the obvious, clicked the "Install Build" link, which gave the me installer window. I accept the agreement, but when I get to the installing components tab, I get this error: http://i.imgur.com/1IJS07f.png
I've trying messing around with some numbers to see if it was a version error, but no luck.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.notresponding.fbtest"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
}
Seeking a solution, thank you :)
EDIT: Adding build.gradle

Error : Failed to find: com.android.support:support-v4:20.0.+

I have imported a project in Android Studio that was built in it. I require v4 and v7 library in the project. This is how my build.gradle looks like
build.gradle
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion '20'
defaultConfig {
applicationId 'com.example.sdk'
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
}
When I sync with gradle then it always gives error message
Failed to find: com.android.support:support-v4:20.0.+ & Failed to find: com.android.support:appcompat-v7:20.0.+
Please support & thanks in advance.
The Android support repository was missing,So go to Android SDK, install the Android Support Repository and Android Support Library.
Also you can use the following
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:appcompat-v7:20.0.0'
instead of
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
Note: If you're developing with Android Studio, select and install the Android Support Repository item instead.
see here.
From Android Studio go to: Tools >> Android >> SDK Manager
Select and install "Extras|Android Support Repository"
add maven to your gradle file (project)
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}
and use this gradle wrapper:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
and downgrade to gradle plugin to be 2.3.1
classpath 'com.android.tools.build:gradle:2.3.1'

Categories

Resources