Gradle Sync failed could not find constraint-layout:1.0.0-alpha2 - android

Problem :
Error:Could not find com.android.support.constraint:constraint-layout:1.0.0-alpha2.
Required by:
myapp:app:unspecified
Background :
Android Studio 2.2 P 1

Support libraries for ConstraintLayout could not be installed/updated.
Just open Preferences > Appearance & Behavior > System Settings > Android and move to SDK Tools tab. Check the following fields and install.

In my case, that support libraries for ConstraintLayout were installed, but I was adding the incorrect version of ConstraintLayout Library in my build.gradle file. In order to see what version have you installed, go to Preferences > Appearance & Behavior > System Settings > Android SDK. Now, click on SDK Tools tab in right pane. Check Show Package Details and take note of the version.
Finally you can add the correct version in the build.gradle file
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
testCompile 'junit:junit:4.12'
}

The fix is to update the android gradle plugin in your build.gradle.
This should work:
classpath 'com.android.tools.build:gradle:2.2.0-alpha2'
Or you can use the latest:
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'

My problem was, that the SDK Tools updated it to the latest version, in my case it was 1.0.0-alpha9, but in my gradle dependency was set to
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
So, you can change your gradle build file to
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
Or you check "Show package details" in the SDK Tools Editor and install your needed version. See screenshow below. Image of SDK Tools

Ensure you have the maven.google.com repository declared in your module-level build.gradle file
repositories {
maven {
url 'https://maven.google.com'
}
}
2.Add the library as a dependency in the same build.gradle file:
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}

I updated my android gradle plugin to 2.2.0-alpha4 and constraint layout dependency to 1.0.0-alpha3 and it seems to be working now

First I tried everything that I have read on stackoverflow...from updating gradle to XY version, to updating ConstraintLayout to XY version...I even update my SDK tools and Android Studio to the latest version...but nothing was working.
The only solution that worked for me was that I delete ConstraintLayout library from gradle and SDK, then I opened random xml layout and in Design view under Palette section search for ConstraintLayout. If you have successfully deleted library from your project then you will be able to install the library from there if you double clicked on ConstraintLayout element.
That has create next line in my app build.gradle:
'com.android.support.constraint:constraint-layout:1.0.0-beta1'
In my project build.gradle I have this:
classpath 'com.android.tools.build:gradle:2.2.2'
Android studio version 2.2.2

Alpha version is no longer available !
implementation 'com.android.support.constraint:constraint-layout:1.1.3'

Just to make sure that in studio version 2.3 you won't see a dropdown near constraint-layout in sdk tools, it will by default install the latest version
To get the desired version check the box saying show package details and boom you can now choose the desired version you want to install

gradle com.android.tools.build:gradle:2.2.0-alpha6
constraint layout dependency com.android.support.constraint:constraint-layout:1.0.0-alpha4
works for me

For me it was a completely different issue. When I installed constraint dependancy in SDK tools, the tools somehow wrote them into the wrong directory. That is
/home/${USER}/Android/Sdk/extras/+m2repository+/com/.../constraint
instead of
/home/${USER}/Android/Sdk/extras/+android+/+m2repository+/com/.../constraint
Remedy:
Just copy the 1.0.0-alpha* directories into the latter path

While updating SDK tools, a dilog box presented with Constraint layout version that is going to get installed. Note that and update your dependency based on that. In my case it was installing beta3.
I changed my dependency like below. After that it worked.
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'

In my case, I had to remove the previous versions first and download the latest one instead. v1.0 stable was released on Feb 23rd.

In my case, I had a multi-module project called "app" and "sdk". The "sdk" module is the one where I had added the constraint layout library. I got the error when I tried to incorporate "sdk" into a new multi-module project called "app2". The solution was to ensure I had added the Google Maven Repository to the project-level build.gradle file for "app2". The Google Maven Repository can be added by putting "google()" under allprojects.repositories in the project-level build.gradle file:
allprojects {
repositories {
jcenter()
google()
}
}

In my case, I was using AS 2.3 and I wanted to use the currently latest ConstraintLayout 1.1.3, but the latest version in my Preferences > Appearance & Behavior > System Settings > Android was 1.0.2.
To use ConstraintLayout 1.1.3, I updated my AS from 2.3 to currently latest 3.2.1, com.android.tools.build:gradle from 2.2.2 to 3.2.1, gradle from 3.3 to 4.6 and buildToolsVersion from 25.0.0 to 28.0.3.
I also added maven { url 'https://maven.google.com' } to the Maven repositories in the project-level build.gradle file and that solved my problem.

Just as a heads up to those still searching for this.
ConstraintLayout 1.0.1 and lower have been deprecated by maven.
For a list of available constraint layouts that can be downloaded, see below:
https://maven.google.com/web/index.html?q=Constrain#com.android.support.constraint:constraint-layout
The easiest solution at the moment, is to change
implementation 'com.android.support.constraint:constraint-layout:1.0.0-beta1'
to
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

I used com.android.support.constraint:constraint-layout:1.0.0-alpha2 with classpath 'com.android.tools.build:gradle:2.1.0', it worked like charm.

Not sure if I'm too late, but in case someone has still the error after an update of ConstraintLayout and Solver over the SDK Tools, maybe this solution could help: Error:(30, 13) Failed to resolve: com.android.support.constraint:constraint-layout:1.0.0-alpha4

Its available in androidx as following package
implementation "androidx.constraintlayout:constraintlayout:2.0.0-alpha1"

Update your constraint layout dependency to the relevant version from '1.0.0-alpha2'. In my case, I changed to the following.
compile 'com.android.support.constraint:constraint-layout:2.0.0-alpha5'

I added the following script in build.gradle(app) under android & I was able to compile.
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}

Similar issue solved by Reinstalling Android Studio.

i'm try constraint layout dependency update available 1,and plugin gradle alpha-6,it worked

Related

Android Studio, Unable to migrate to AndroidX

I'm having the following error message when trying to do refactor -> migrate to AndroidX
The gradle plugin version in your project build.gradle file needs to
be set to at least com.android.tools.build:gradle:3.2.0 in order to
migrate to AndroidX
Although I have version higher specified in build.gradle...
app/android/build.gradle
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
I have another app/android/app/build.gradle.
I solved it by changing version to 3.4.1 and back to 3.4.2.
now error is gone..
in my case,
apply
classpath("com.android.tools.build:gradle:4.0.1")
instead of
classpath("com.android.tools.build:gradle:${version.gralde}") -> even version.gralde is 4.0.1
:thinking :) maybe android studio can't identity the plugin version if it references to an external value
Only change gradle version of a project may be not enough. Please also check gadle versions of the dependies. Make sure every gradle version of a depency is beyond 3.2.0. Have a try, please.

Android studio missing classes (Constraint Layout) (has been resolved)

Android studio missing classes.
The layout is blank.
Main.Activity is red letters.
[Soultion in the answer area]
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
add this line under dependencies in your build.gradle file
If Android Studio is not identifying the project as Gradle based, it means you imported the project source code from wrong directory. Try to reimport the project from a directory where you have see build.gradle file.
Follow these steps Add ConstraintLayout to your project
Or if you are using AndroidX
You need to use different build artifacts
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
Refer here for AndroidX Migrating to AndroidX
My Solution:
First,I delete Android Studio,and then Download Android Studio(include emulator and SDK) again.
Second,I change the name of my homework.
Third,I choose "Open an existing Android project".
Forth, Gradle Scripts->build.gradle->
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
}
replace
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
Done.

Cannot resolve symbol 'Theme' in styles.xml (Android Studio)

Since today, Android Studio can't find the AppCompat themes in styles.xml, but for example AppCompatActivity in code does get recognized. My Android Studio version is 2.2.2, Build #AI-145.3360264
I already tried upgrading to the latest build tools, compile sdk (25) version etc. but it didn't fix the problem.
At the moment I have installed the following (from sdk manager):
android api: 19 and 23
sdk platform tools: 25.0.1
sdk tools: 25.2.3
build-tools: 23.0.2 and 25.0.1
support repository: 40
google repository: 39
and a few others, that shouldn't be necessary to list here.
build.gradle of app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.1'
defaultConfig {
applicationId "xxx.xxxxxxxx.xxxxxxxxx" //not the real applicationId
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/RootTools.jar')
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:support-v13:23.+'
compile 'com.android.support:appcompat-v7:23.+'
compile 'com.android.support:design:23.+'
compile 'com.android.support:cardview-v7:23.+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
Another solution that worked for me with Android Studio 3.1.2:
delete these from build.gradle if you have them:
'com.android.support:appcompat-v7:27.1.1'
'com.android.support:design:27.1.1'
then sync,
then undo delete,
then sync again.
I encountered this after updating to Android Studio 3.1.
None of the other answers listed here worked for me, however when I switched my appcompat support lib version to the latest 28.0.0-alpha1 then back to 27.1.0 that it was on before, it worked.
Seems the new version of Android Studio lost connection to where the library was synced to and just needed to have it reset.
No need to change anything.
Just press small button on top "Sync Project with Gradle Files"
EDIT: As #Alexey noted, bug still appears in Android Studio v3.1.4
This worked for me:
Click File > Close Project
Reopen the project from Studio's dialog.
That's because of feature called "build cache" that is enabled by default in build Android Plugin since 2.3.0.
It creates files in build cache outside of project folder (in my case -- in \Users\%username%\.android\build-cache)
Theese files are intended to be common between your projects.
And then Android Studio is unable to navigate in theese files.
That's all.
If you want to disable Build Cache, add android.enableBuildCache=false to gradle.properties file. Then restart Android Studio.
more info here:
https://developer.android.com/studio/build/build-cache.html#disable_build_cache
I have had the same problem. The only solution that worked for me was to manually delete the support libraries in file system and sync the project to let Android Studio download them again.
Steps:
Go to your project folder in File system
Go to .idea\libraries
Delete all the Gradle__com_android_support_****.xml files
Open Android Studio
Select File > Sync with File System
Once that is done, Select File > Sync Project with Gradle Files
Build Project
And now your error should be gone!!!
you can hit file -> invalidate Caches / Restart ... if it doesn't fix the issue you can close the project (file-> close project) and import it (file -> new -> import project.
I switched support lib to version 27.1.1 and problem has been solved. Seems like some bug in 27.1.0
I went through the same problem when I upgraded to alpha-2.
I looked at this link: http://tools.android.com/recent, but the only thing that worked well was:
Change this:
Classpath 'com.android.tools.build:gradle:2.3.0-alpha2'
For this:
Classpath 'com.android.tools.build:gradle:2.2.3'
In your build.gradle (Project)
Only this worked for me
Close project (File> Close Project)
Import / Re-Open project again (NOT from Recent)
Error should be resolved now.
If that fails, try below-
Open build.gradle, remove appcompact-v7 dependency and sync project.
Add appcompact-v7 dependency and sync.
I encountered same problem like this.Just the difference is I was using Studio 2.2.3. This is what solved my problem:
In my project level gradle I had:
classpath 'com.android.tools.build:gradle:2.3.0-alpha2' (which was a result of updating studio)
which I replaced with:
classpath 'com.android.tools.build:gradle:2.2.3'
I think you should look for a compatible classpath for your gradle configuration.
I was having the same issue after linking Firebase to my app. Updating the build.gradle in the app module did the trick, updated to:
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
I had also the same problem when I upgraded my android studio from 2.2.2 to 2.3 Canary Version.
Although the new beta version of 2.3 is released yet it is using the gradle plugin of 2.2.3 which is of stable version.
So just change the classpath dependency in buildscript of build.gradle project level from alpha to 2.2.3 and sync it. It'll resolve the issue or change to the more appropriate version with respect to your channel version.
More on gradle watch this Gradle Recipes for android Ken Kousen - Gradle Summit 2016
https://www.youtube.com/watch?v=4L6wHTVmxGA
In newer versions of Android Studio, we are asked to use 'AppCompat'. Some users uncheck that and still use the Theme.AppCompat. That makes up this error. Same happened with me.
Solution is to add this line in your build.gradle (app).
compile 'com.android.support:appcompat-v7:26.1.0'
#Daniel Wilson made a comment in one of the answers that solved this issue for me. I wanted to add add as an answer to draw more attention to this solution.
Updating compileSdkVersion and targetSdkVersion from 26 to 27 (and then of course updating the dependencies) eliminated the errors for me.
Mine was fixed by deleting the .gradle file from the folder and re-importing the project in Android Studio
I also faced the problem with Android Studio 3.1 , syncing does not help me.
Then I switched back to
`'com.android.support:design:27.1.0'` from : `'com.android.support:design:27.1.1'`
and added android.enableBuildCache=false to gradle.properties to disable build cache
This is weird, I encounter this problem as below:
Android Studio is 3.1.2
support lib version is 27.0.0
I solve this by below:
change support lib version to 27.1.0, and "Sync Project with Gradle Files", then this error disappear
change support lib version to 27.0.0,and "Sync Project with Gradle Files", then this error not appear again
Deleted .idea and .gradle from project folder.
Then sync with gradle files, it worked.
I ran into the same problem when updating the Android Studio software.
What I did was this:
Go to the Gradle Settings as follows (this path is for Mac, but should be similar on Windows):
Android Studio -> Preferences -> Build, Execution, Deployment ->
Gradle.
Then pick "Use default gradle wrapper (recommended)".
If you already have that option chosen then your problem must lie somewhere else.
I changed my gradle version from
classpath 'com.android.tools.build:gradle:2.3.0'
to
classpath 'com.android.tools.build:gradle:2.2.3'
and it works now!
In Android Studio 3.1.3, the simple work around:
"Sync Project with Gradle Files"
If none of these methods mentioned by other contributors does not work for you..
Then please simply ignore this...
Even flutter officials also said to ignore these errors..
Caution*** Only ignore after trying all the methods.If above methods solve your errors then fine otherwise you can ignore these..
This type of errors happen after installing latest version of flutter sdk,gradle ,android studio and other plugins -packages
If you are using latest version then you have to ignore these errors.

Android Studio 2.0 - Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to

I updated the Android Studio version 2.0 and was using normally. When I created a new project today, it is displaying the error Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to
I realized that this problem occurs only when I create a new project. In previous projects developed, the problem does not occur and I realized that gradle is different
classpath 'com.android.tools.build:gradle:1.3.0'.
I have to update with the same set of old projects?
My app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "luizugliano.com.br.teste"
minSdkVersion 16
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
My build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
UH OH, Google Notice: "This website no longer provides downloads for Android Studio."
(Old 'channel' links no longer work. Links in this answer have been updated to the new formats, make sure to change your bookmarks if you were using them)
You need to update the version of the gradle tools you are building with. This can be found inside the dependencies section of your build.gradle. You have 3 options you can update to:
The latest stable version referenced in the release channel as of 2nd March, 2017 is
classpath 'com.android.tools.build:gradle:2.3.0'
Or the latest beta version via preview channel as of 15th February, 2017 is
classpath 'com.android.tools.build:gradle:2.3.0-beta4'
And the latest alpha version also from the preview channel as of 21st March, 2017 gives you the option to use
classpath 'com.android.tools.build:gradle:2.4.0-alpha3'
Updating requires you to also upgrade the gradle wrapper. As of 20th February '17, the newest is:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip
On android studio you can find your wrapper by changing to the project view and looking in gradle/wrapper/gradle-wrapper.properties
Sometimes after changing wrapper the project will fail to compile with an error like “Minimum supported Gradle version is 2.14.1. Current version is 2.10. Try changing Gradle distribution version to...” despite already having the correct version in gradle-wrapper.properties. If that happens try the following:
Go to Settings > Build, Execution, Deployment > Gradle
Under Project-level settings ensure that Use default gradle wrapper (recommended) is the selected option, then re-build your project.
(Additional Note: With regards to the alpha and beta versions - there is not always a newer build than the stable version when I check, in those cases I've just given values for the previous version. This allows you to roll back to that version if you experience issues with the released version)
In new project change this part:
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
with
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'.
If you're not experienced user, please stick with Android Studio's Updates Stable Channel. I suppose you got Android Studio from Canary Channel.
Note that:
The Canary Channel for Android Studio delivers the bleeding edge updates on a roughly weekly basis. While these builds do get tested,
they are still subject to bugs, as we want people to see what's new as
soon as possible.
From: http://tools.android.com/download/studio/canary
You don't need to change dependencies of your older projects. They should run normally on the latest version.
Same problem on update.
this Fixed it for me:[build.gradle]
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
or
classpath 'com.android.tools.build:gradle:2.0.0-beta2'
Just in Advanced System Settings in Windows Properties, add a new environment variable with the name ANDROID_DAILY_OVERRIDE and the given value in error message. Restart android studio and you will be ready to go
As of April 5, 2016 this worked for me:
classpath 'com.android.tools.build:gradle:2.0.0-rc3'
gradle version you need became
classpath 'com.android.tools.build:gradle:2.0.0-beta7'
Which requires you to use the gradle wrapper for 2.10 if you were still using previous version
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
On android studio you can find your wrapper by changing to the project view and looking in gradle/wrapper/gradle-wrapper.properties
classpath: com.android.tools.build:gradle:+
This will solve the problem by updating gradle to latest one.
However it is dangerous(will code in alpha stage) & will also give warnings.
If you are using Android Studio 2.0 Preview I can suggest using 'beta' updates channel instead of 'stable'. It will allow you to receive latest gradle configuration changes. You can change updates channel in Settings - Appearance & Behavior - System Settings - Updates. Select Automatically check updates for [Beta Channel]
In order to know actual version of gradle classpath and distributionUrl (check Nick Caroso's answer) you can create new empty project and see these values there.
You need to change your gradle-wrapper.properties file in gradle/wrapper folder of your app, change your distributionUrl as this:
distributionUrl=http\://services.gradle.org/distributions/gradle-2.8-all.zip
Use http: or https:\ as per your requirement.
Then just clean your project and you are done!!!
Side Note :
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
is available now, if you want to use latest version.
Also you can take advantage of instant run feature of android studio using this, which is not available in gradle version below 2.0.0
Android Studio 2.0 has an update project to use instant-run. For those like me with little brains:
http://tools.android.com/tech-docs/instant-run
The current version of Android Studio 2.0 is Beta 6.
try update gradle to 2.10
for mac, tha path is Android Studio > Preferences > Builds,Execution,Deployment > Build Tools > Gradle
of course you must download gradle 2.10 before
I got the same error on 04/07/2016 with
'com.android.tools.build:gradle:2.2.0-alpha2' and gradle wrapper 2.10
then, I just changed to
'com.android.tools.build:gradle:2.2.0-alpha3'
now I have no problems.
Hope this help peple.
I have resolved this way.
Steps:
Open gradle-wrapper.properties file and change distributionUrl to https\://services.gradle.org/distributions/gradle-2.14.1-all.zip.
Open root level build.gradle and change classpath to com.android.tools.build:gradle:2.2.2.
Sync your Android studio project.
Reference screen shot:
Done.
just change
classpath 'com.android.tools.build:gradle:2.0.0-alpha '
or
classpath 'com.android.tools.build:gradle:2.1.0'
I change my classpath from 'com.android.tools.build:gradle:2.2.0-alpha4'
to classpath 'com.android.tools.build:gradle:2.2.0-alpha5'
and clicked "try_again" when the warning appears "unable to find cached classpath" you just click "sync", this worked like a breeze.
This problem occures generally when the IDE(android studio) in which project is build and the project are not in compatible gradle plug in. Please check the link below
http://tools.android.com/tech-docs/new-build-system/version-compatibility
In my case i had created a project using AS 1.0/2.0 version, and later imported in studio version new it gave me error then I opened project in older version of AS it worked.
you can also check http://tools.android.com/tech-docs/new-build-system
File -> Project Structure -> Project -> Android Plugin version = 2.2.3
Working fine of Android Studio 2.2.3

How to add Android Support Repository to Android Studio?

I'm using Android Studio with an external Android SDK. I have installed the support library and the support repository. The support repository is in:
~/Development/Tools/android/sdk/extras/android/m2repository
When I add a dependency to the support library in the build.gradle file, like:
...
repositories {
mavenCentral()
}
...
dependencies {
compile "com.android.support:support-v4:18.0.+"
}
Android Studio cannot find the support libraries (cannot resolve symbol etc) and Gradle also cannot find the libraries:
Gradle: A problem occurred configuring project ':TestAndroidStudio'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':TestAndroidStudio:_DebugCompile'.
> Could not find any version that matches com.android.support:support-v4:18.0.+.
Required by:
TestAndroidStudio:TestAndroidStudio:unspecified
How do I specify in Android Studio and/or the build.gradle file the location of the Android support repository?
You are probably hit by this bug which prevents the Android Gradle Plugin from automatically adding the "Android Support Repository" to the list of Gradle repositories. The work-around, as mentioned in the bug report, is to explicitly add the m2repository directory as a local Maven directory in the top-level build.gradle file as follows:
allprojects {
repositories {
// Work around https://code.google.com/p/android/issues/detail?id=69270.
def androidHome = System.getenv("ANDROID_HOME")
maven {
url "$androidHome/extras/android/m2repository/"
}
}
}
Gradle can work with the 18.0.+ notation, it however now depends on the new support repository which is now bundled with the SDK.
Open the SDK manager and immediately under Extras the first option is "Android Support Repository" and install it
Found a solution.
1) Go to where your SDK is located that android studio/eclipse is using.
If you are using Android studio, go to extras\android\m2repository\com\android\support\.
If you are using eclipse, go to \extras\android\support\
2) See what folders you have, for me I had gridlayout-v7, support-v4 and support-v13.
3) click into support-v4 and see what number the following folder is, mine was named 13.0
Since you are using "com.android.support:support-v4:18.0.+", change this to reflect what version you have, for example I have support-v4 so first part v4 stays the same. Since the next path is 13.0, change your 18.0 to:
"com.android.support:support-v4:13.0.+"
This worked for me, hope it helps!
Update:
I noticed I had android studio set up with the wrong SDK which is why originally had difficulty updating! The path should be C:\Users\Username\AppData\Local\Android\android-sdk\extras\
Also note, if your SDK is up to date, the code will be:
"com.android.support:support-v4:19.0.+"
Android Studio 3
Make sure you have the latest version of Android Studio. The support library is included by default when you create new projects. If you are adding the Support Library to a project that doesn't have it, then you just need to add a single line to your app module's build.gradle file, and then sync gradle.
build.gradle
dependencies {
...
implementation 'com.android.support:appcompat-v7:27.1.1'
}
It should just be that easy, though there may be some things to note:
Android Studio should give you a warning nowadays if the support library needs to be updated. Just update the 27.1.1 numbers that I have here to whatever it tells you to. You can also manually check what the latest revision is if you want to.
The implementation keyword replaces compile that was used in Android Studio 2.x. (What's the difference?)
There are other support library packages that you may need to include depending on what your app uses (like constraint-layout or recyclerview).
Make sure that you have the latest updates for everything in the SDK Manager. Go to Tools > SDK Manager.
Documentation
Support Library
Support Library Setup
Support Library Features
I used to get similar issues. Even after installing the support repository, the build used to fail.
Basically the issues is due to the way the version number of the jar files are specified in the gradle files are specified properly.
For example, in my case i had set it as "compile 'com.android.support:support-v4:21.0.3+'"
On removing "+" the build was sucessful!!
Instead of doing this:
compile "com.android.support:support-v4:18.0.+"
Do this:
compile 'com.android.support:support-v4:18.0.+'
Worked for me

Categories

Resources