Currently my dependencies look like:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/volley_1_0_8.jar')
compile 'com.android.support:support-v4:21.0.2'
compile 'com.android.support:support-v7:21.0.2'
compile files('libs/volley.jar')
compile files('libs/picasso-2.4.0.jar')
}
Which gives me the following error:
Error:Failed to find: com.android.support:support-v4:21.0.2
Install Repository and sync project
Open File
Open in Project Structure dialog
It looks like I have everything needed inside the SDK:
Clicking on "Install Repository and sync project" prompts me to install the support repo rev 9 (which I already have, according to the SDK manager?)
While installing I always get the error
Failed to rename directory C:\Program Files (x86)\Android\android-studio\sdk\extras\android\m2repository to C:\Program Files (x86)\Android\android-studio\sdk\temp\ExtraPackage.old01.
It seems the directory is in use by Android Studio itself.
The question: how can I install the v7 support?
The current version of the support-v4 is 21.0.0. There is no such library as support-v7 - if you mean appcompat-v7, then that is also 21.0.0 as per gradleplease.appspot.com, which is a handy reference for the latest versions of various libraries.
The reason the SDK Manager has the version at 21.0.2 is because other parts of the support library (specifically, the Multidex support library) was changed since the initial release of version 21.0.0, but that did not change the support-v4 or other parts.
Related
i find 2 solutions for this problem, but both didn't work. So i decided to ask you.
I'm using Debian 8 Jessie and Android Studio 1.4
I just created new project and when i tried to start it i got an error:
" Failed to resolve: com.android.support:appcompat-v7:15.+ "
And gives me 3 option.
1) Install Repository and sync project
When i tried it i got an error like this:
Loading SDK information...
Ignoring unknown package filter 'extra-android-m2repository'Warning: The package filter removed all packages. There is nothing to install.
Please consider trying to update again without a package filter.
And down of the window:
Install failed. Please check your network connection and try again. You may continue with creating your project, but it will not complete correctly without the missing components.
2) Show in File
It's my build.gradle dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:15.+'
}
Error in this line:
compile 'com.android.support:appcompat-v7:15.+'
3) Show in Project Structure dialog
Dependencies windows is opened and about this line again:
compile 'com.android.support:appcompat-v7:15.+'
Tried Solutions:
Firstly, i tried to download version sdk again. I deleted Android 4.0.3 and re-download again but still same error.
After that i tried to download support library which recommended in; topic 1 , topic 2. After i download Android Support Library, rev 23.0.1 still got same error.
After that i tried to solve my problem with fixing first option in error (install repository and sync project. And i found some topics again. I checked my HTTP Proxy section in Setting, already "No proxy" is selected.
So, i tried everything i found, but still i got this error. Someone can help me please?
After you downloaded the latest support library with your sdk manager, you can set that version in your gradle file.
If you downloaded 23.0.1 set it like this:
compile 'com.android.support:appcompat-v7:23.0.1'
EDIT:
Also note following hint, given by Android Studio, when using + in Version number:
Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds (com.android.support:appcompat-v7:23.1.+)
Using + in dependencies lets you automatically pick up the latest
available version rather than a specific, named version. However, this
is not recommended; your builds are not repeatable; you may have
tested with a slightly different version than what the build server
used. (Using a dynamic version as the major version number is more
problematic than using it in the minor version position.)
Edit build.gradle
Replace 'com.android.support:appcompat-v7:15.+' with 'com.android.support:appcompat-v7:18.0.0'
Sync It
May be this will help you. If in case this will not work i.e. show error then see for installation of app-compat in "%homepath%\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\appcompat-v7"
Search for the oldest version and put the version number at xx: 'com.android.support:appcompat-v7:xx'
I installed Java and Android Studio today.
When creating my first project with API level 15 as minSDK, I faced the same problem.
As far as I can tell, it seems the installation of the sdk works not pretty well. For me, API level 15 had only the SDK platform. API level 23 had platform and sources. I don't remember, which tools where installed.
To solve the problem, I started the sdk manager (old version), removed api level 15 completely and installed api level 23 as suggested. After that, a newly created project (again with minSDK 15) was properly created.
The difference in the app/build.gradle file is obvious.
Maybe this helps other people facing the same issues, or one of the gurus can further explain, what happened.
Kind Regards
Got same errors.
Mac OSX
V. 10.9.5
Android studio 1.4.1
App:
Before:
android {
compileSdkVersion 15
buildToolsVersion "19.1.0"
After:
android {
compileSdkVersion 23
buildToolsVersion "19.1.0"
Before:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:15.+'
}
After:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.o'
}
Above changes + Build >> Clean Project.
Hope that helps!
Go to Built tab select "Edit Built types" select properties tab and check built tool version it was 19.1.1 for me.
Then go to built.gradle change compile to 'com.android.support:appcompat-v7:19+' . I changed to 19+ because my built version is 19.1.1 ; You have to select according to your built version(18+,19+,20+ like that).
Try following solution:
In Android studio:
Go to File -> Project structure
Check the selected Build Tools Version.
update your build.gradle for app with selected build tools version.
for e.g. 19.1.0
After update, Run Clean.
Please refer below screenshot.[Project Structure-> Build Tools Types][1]
I had a similar error message when creating a project.
fail to resolve com.android.support:appcompat-v7:14.+
I notice that if I create a new project with support for 4.0.3 instead of 4.0, no error occurs. I am using android studio 1.5. Hope this helps.
in my case, support and wearable versions were different, after making them exactly same, gradle build completed successfully.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:1.0.0'
compile 'com.google.android.gms:play-services-wearable:11.0.4'
provided 'com.google.android.wearable:wearable:1.0.0'
}
I am new to Android development. so the external libraries (aka. dependencies) are defined in build.gradle like
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v13:21.0.0'
compile 'com.squareup.dagger:dagger:1.2.1'
compile 'com.google.code.gson:gson:2.1'
compile 'de.greenrobot:eventbus:2.4.0'
}
Is there an easy way to find out if any of these libraries has got a newer version for update? I noticed that Android Studio reminds new version available for gson but not for other libraries.
I'm from the iOS background, CocoaPods is the tool we use to manage external libraries. Using pod outdated command, it is very easy to figure out which libs have new version for upgrade.
There is a lint option called "Newer Library Versions Available".
You may need to add this to your build.gradle as well:
android {
...
lintOptions { warning 'NewerVersionAvailable' }
}
Then you can run Analyze > Run Inspection By Name... > Newer Library Versions Available to get a list of outdated dependencies.
Bintray has a watching mechanism that notifies you when a new version of a package you're watching is updated.
I am with JFrog, the company behind Bintray and [artifactory], see my profile for details and links.
I have been trying to add android-support-v13 in Android Studio 1.0.2
I have followed the steps here but I still get a build fail. Has anyone successfully managed to add android-support-v13.jar into Android Studio 1.0.2?
Below is my code in my gradle file.
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile fileTree(dir: 'libs',include: '*.jar')
Edit: I have installed extra support library from SDK manager and I have placed the .jar in my libs folder.
according to docs at this time:
The Gradle build script dependency identifier for this library is as
follows:
com.android.support:support-v13:18.0.0
lets hope that the docs are updated.
for the latest you should use:
compile 'com.android.support:support-v13:21.0.+'
same problem android studio 1.0.2 i solve that below
compile 'com.android.support:appcompat-v7:21.0.1'
compile 'com.android.support:appcompat-v7:+'
I am following this link, as mentioned in the link I am trying to add recycle view as follows:
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
I have added android-support-v7-appcompat library project and also tried adding recyclerview-v7-21.0.0-rc1.aar to libs but still I am getting following error.
The following classes could not be found:
- android.support.v7.widget.RecyclerView
Note: I have updated Android SDK Tools, Android SDK Platform Tools, Android SDK Build Tools, Android L (API 20, L Preview)
please help..
You can't add the aar file to libs folder in Eclipse (it isn't a jar file)
The best way to work with the new RecyclerView is, currently, to switch to Android Studio and add this dependency to your build.gradle
compile 'com.android.support:recyclerview-v7:+'
Just a note. It is not a good practice to use the '+' placeholder, but in this case you are trying a preview release, so it will be update soon with stable release.
You can use one of these versions.
Check your sdk for updated version:
//it requires compileSdkVersion 23
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.0'
//it requires compileSdkVersion 22
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
//it requires compileSdkVersion 21
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.0'
Of course you can still use Eclipse but it will requires some manual operations.
You can find all the release of the support libraries library in this folder:
sdk/extras/android/m2repository/com/android/support/
Here you can check all version.
In the folders you will find the aar file of the support libraries.
Inside you can check the classes.jar file,the res folder and the AndroidManifest file.
Create a project in your workspace
Unzip the AAR into some directory.
Copy the AndroidManifest.xml, the res, and assets folders from the AAR into your project.
Create a libs directory in your project and copy into it the classes.jar
Add the dependency.
Use the SDK 23 to compile
Mark the project as a library
The Recyclerview library has the support-v4.jar and the support-annotations-23.x.X.jar as dependencies.
ECLIPSE
If your problem is not solved or for future readers , here is the answer: From android sdk manager download Android Support Library first.
Go to this location and copy .aar file from here
X:\android-sdk\extras\android\m2repository\com\android\support\recyclerview-v7\21.0.0
Then rename it as .zip file then unZIP it then find classes.jar file , rename it with some proper name like 'RecyclerView_v7.jar' Then copy the that .jar file in you project library. Add it to build path then restart eclipse so that it can be instantiated (not necessary but i had to do this).
**=================================Update=======================**
After new Library Updates; RecyclerView,CardView etc are available as simple library projects.! :)
File~>Import~>Existing Android Code~>SDKpath~>extras~>android~>support~>
v7~>recyclerView.
Then right click on this project , go to properties under Android check Is Library. It is done ..!
Now open your app in which you want to use recyclerView.
goto properties of your app Project under Android add Library here you will find that Library project add that (remember don't make your app a library project by checking 'Is Library'), now go to your App Project's
Properties~>Java Build Path~>Libraries~>Add Jars~>RecyclerView LibraryProject~>libs
Then add that jar into your project and buildpath .! Pheeew.. :)
Question:
How do I find the version of libraries that are being used when my Gradle file mentions a dependency using the '+' operator in the version number of the dependency?
Context
My build.gradle under app module reads like so:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:5.+'
}
What is the version of the play-services library that is being used here?
You can use gradles' build-in 'dependencyInsight' task to query the resolved version of your dependency:
gradle dependencyInsight --configuration compile --dependency com.google.android.gms:play-services
If you want to get an overview for all your dependencies in one go, you can do
gradle dependencies
If you use the gradle wrapper you must use ./gradlew instead of gradle
Look under .idea folder of your project
In the Project Pane on the left, browse to .idea/libraries
All the library dependencies that your project has have been mentioned, with each one getting its own xml file. You can see the version number included in the xml file title. The xml itself has the library file path.
(OR) Use Gradle's built in task to get dependencies
See steps here: https://stackoverflow.com/a/25236208/1311745
Android Gradle Dependency library version
Android Studio 3.1.4
You are able to use Project view
In Android Studio, in the build.graddle app, select the version and press ALT + ENTER, then select "Replace with specifyc version"