Recently I updated my studio to 2.0, along with several other build-tools, library updates.
Since then, I keep getting these two errors -
Error:(25, 13) Failed to resolve: com.android.support:design:22.0.1
Install Repository and sync project<br>
Error:(24, 13) Failed to resolve: com.android.support:appcompat-v7:22.0.1
Install Repository and sync project<br>
I have searched SO and the web for possible solutions and have tried resolving using API 21, API 22 and API 23 versions of the same appcompat and design repository.
This is my gradle file for the API 22 version -
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
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:22.0.1'
compile 'com.android.support:design:22.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
}
Please note that I have the Android Support Repository and Support library updated to their latest versions.
My SDK manager:
For reference, I have tried the solutions in these posts:
Android Studio-Failed to resolve:com.android.support:appcompat-v7.22.2.0
Android appcompat v7:23
failed to resolve com.android.support:appcompat-v7:22 and com.android.support:recyclerview-v7:21.1.2
Couldn't compile android studio project
Well, I resolved the problem by changing the version of the appcompat-v7 and design repositories to 22.0.1 from 22.2.1. 22.0.1 is not a valid dependency version.
In my gradle file ->
compile 'com.android.support:appcompat-v7:22.0.1'
compile 'com.android.support:design:22.0.1'
Changed this to
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
Click Install Repository and sync project and continue install.
Related
I can't install Android SDK Tools on Android Studio (version 2.3).
I got the following error,
Is there anyway I can solve this error?
TLDR; no.
Google, for whatever reason, has decided to remove direct access to the standalone SDK Manager starting with Android STudio v2.3.
If you run SDK manager directly using #iK2H 's instructions, you will see that SDK manager does not detect Android SDK Tools v25.3.1.
It could be that v25.3.1 is only available via Android Studio settings, but this is broken for now.
Your best best is to upvote this issue to draw attention to Google to fix it.
Open the terminal
$ cd "sdk path"/tools
$ ./android
Update
Google fixed this, on the server side, shortly after discovery. It should work now.
File -> Invalidate Caches / Restart
or
Build -> Clean Project can help (let me know if it did)
From Windows, search for SDK Manager and right click to 'run as administrator'. Attempt to the install it from there.
Was having the same issue and that worked for me...
Ok, I think I found the solution. Please try it out and report back on comments. Build is a success, but I still need to test by app to check for features and other possible side effects. Did not want everyone to wait until this is resolved. If this does not work or has serious issues, I am happy to delete this answer.
PLEASE COMMENT
The solution
I commented out
compile 'com.google.android.gms:play-services:x.y.z'
I also removed
com.google.android.gms:play-services-appindexing
com.google.android.gms:play-services-contextmanager
Upgraded the remaining com.google.android.gms:* services to 10.2.0
This is my working build.gradle with no errors
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled = true
}
def applicationVersion = '*****'
dexOptions {
// incremental = true; // If anybody use below 2.2.2 android studio then please uncomment this line. It's by default true.
preDexLibraries = false
javaMaxHeapSize "2g"
}
signingConfigs {
....
}
buildTypes {
...
}
productFlavors {
...
}
packagingOptions {
...
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:25.1.1'
// compile 'com.google.code.gson:gson:2.2.4'
compile 'com.fasterxml.jackson.core:jackson-core:2.6.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.crittercism:crittercism-android-agent:+'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.google.android.gms:play-services-base:10.2.0'
// compile 'com.google.android.gms:play-services-appindexing:10.2.0'
// compile 'com.google.android.gms:play-services-contextmanager:10.2.0'
compile 'com.google.android.gms:play-services-places:10.2.0'
compile 'com.google.android.gms:play-services-nearby:10.2.0'
compile 'com.google.android.gms:play-services-maps:10.2.0'
// compile 'com.google.android.gms:play-services-ads:10.2.0'
// compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.google.android.gms:play-services-analytics:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
// compile 'com.google.android.gms:play-services-awareness:10.2.0'
// compile 'com.google.android.gms:play-services-cast:10.2.0'
// compile 'com.google.android.gms:play-services-plus:10.2.0'
compile 'com.google.maps.android:android-maps-utils:0.4.+'
compile 'com.google.zxing:core:3.2.0'
compile 'com.journeyapps:zxing-android-embedded:3.3.0#aar'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-analytics:10.2.0'
compile 'com.flurry.android:analytics:6.4.2'
....
}
apply plugin: 'com.google.gms.google-services'
Update your SDK tools from old "SDK Manager" UI (You can find it at <your SDK>/tools/android) to 25.2.5 then update it from Android Studio to latest version (26.1.1).
For some reasons you can't see newer versions in SDK Manager UI.
Something behind the scenes happened and my project will no longer build and/or run because of a conflict in the dependency stack.
I have tried to tinker with the version numbers of the dependencies and can confirm that the facebookSDK project is set to build with support lib v22. How can I figure out what is causing the v23 appcompat support lib to get pulled into my project?
Here's the build error I am getting:
/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/res/values-v23/values-v23.xml
Error:(2) Error retrieving parent for item: No resource found that matches the given name
'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
And the gradle info:
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
}
}
dependencies {
compile project(':facebookSDK')
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:multidex:1.0.0'
...
}
Facebook with its facebook-android-sdk tries to keep their dependencies as latest as possible. You had an issue with 23.0.0Android support libraries version, I with 23.1.1...:-)
I highly recommend to change your existing configuration to this one:
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:multidex:1.0.0'
...
compile 'com.facebook.android:facebook-android-sdk:4.+'
}
Look, you can even add facebook-android-sdk as Gradle's dependencies, so you can delete existin folder and don't bother about stay fresh with it.
You can also stay with your a bit low targetSdkVersion, which is good when you don't want to implement things like Android permissions or Doze mode compability.
Hope it will help
You can update these lines to the latest versions without affecting which API level you can run the code at. You are missing the v23 resources, so compile with at least version 23.
compileSdkVersion 22
buildToolsVersion "22.0.1"
These lines should be the same version, but they aren't even needed when you use the support:design library. Feel free to delete these.
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.2.1'
For this line, I highly doubt that you are using all of the Google play services. Please read about only using those you really need in your app.
compile 'com.google.android.gms:play-services:8.4.0'
After you narrowed down those possibilities, I'd suggest you use these (from experience, seems to work fine).
compile 'com.android.support:design:23+'
compile 'com.android.support:cardview-v7:23+'
Since you haven't shown the Facebook dependencies, it's hard to give advice about that
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "SOMEID"
minSdkVersion 15
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.guava:guava:18.0'
compile 'com.google.guava:guava:18.0'
compile 'com.google.guava:guava:15.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I am fairly new to android, so please be aware. The application that I have been working on was under Ant build, and now have to change to Gradle to work with other new dependencies. And now, I am getting the following errors after migration through Android Studio->Import->Projects:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK overview-frame.html
File1: /Users/taeyounglee/StudioProjects/adr-android/app/libs/ormlite-android-4.45-javadoc.jar
File2: /Users/taeyounglee/StudioProjects/adr-android/app/libs/ormlite-core-4.45-javadoc.jar
Below are the ones that are in libs folder, I even tried hard-coding the dependencies on the build.gradle as well, but didn't work out:
HockeySDK-3.5.0.jar
http-request-4.2.jar
jsr305-2.0.1.jar
libGoogleAnalyticsV2.jar
ormlite-android-4.45.jar
ormlite-android-4.45-javadoc.jar
ormlite-android-4.45-sources.jar
ormlite-core-4.45.jar
ormlite-core-4.45-javadoc.jar
ormlite-core-4.45-sources.jar
otto-1.3.4.jar
picasso-2.1.1.jar
Any suggestions on this? The app uses ormlite, and requires both .jar files, as when I tried removing either one of those, it just throws compile errors. I tried looking up online about APK overview-frame.html, but can't seem to find reasonable answer. Help much appreciated, and thanks in advance!
If you can avoid it, stop using the jars. Gradle makes pulling dependencies down from Maven or JCenter super easy. When adding libraries like this to your projects, start thinking in terms of adding the dependency via accessing JCenter or Maven instead of manually downloading and placing the jar in your project.
compile 'com.j256.ormlite:ormlite-android:4.45'
compile 'com.j256.ormlite:ormlite-core:4.45'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup:otto:1.3.8'
compile 'net.hockeyapp.android:HockeySDK:3.7.2'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.github.kevinsawicki:http-request:6.0'
Here's their associating website references:
OrmLite
Picasso
Otto
Hockey
Analytics
HTTP Request
I got this below error
Error:(1, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in C:\Users\TARUN\Desktop\GingerBuds\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip
Then I changed the above gradle path, Then following problem occurred,
I am getting this exception, while building my project . I rebuild and clean the project and updated google-play-services , then also i got error. can anyone please help me how to solve this.
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: C:\Users\TARUN\Desktop\Gingerbuds\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\jars\classes.jar (The system cannot find the path specified)
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.kitchenvilla.gingerbuds"
minSdkVersion 15
targetSdkVersion 23
versionCode 24
versionName "1.2.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
android {
useLibrary 'org.apache.http.legacy'
}
android {
publishNonDefault true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.mcxiaoke.volley:library:1.0.15'
compile 'org.apmem.tools:layouts:1.10#aar'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
}
This bug has been fixed according to Google dev blog: http://tools.android.com/tech-docs/new-build-system
2.0.0-alpha6 (2016/1/15)
Instant Run
Fix alpha5 reported issues :
- cannot build when importing play-services.
You should update android gradle tools version
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
}
This exception is thrown during a failed attempt to open the file denoted by a specified Path-name.
You can use
compile 'com.google.android.gms:play-services:8.3.0'
Update your classpath
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
this will solve it
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha2'
}
and
compile 'com.google.android.gms:play-services:8.3.0'
update gradle version to alpha9 in project level gradle file
classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
i tried to import admob ads to a new app i was making and i ran into this problem...... i found the solution the be the StartAppInApp file being located in the wrong spot or not being there..... my app needed the StartAppInApp-3.1.1.jar file to be located in the libs folder and when i looked at my app there was no libs folder located there at all .....
open your main app folder... then click app and you should have 3 folders.... src ... build.... and libs .....
in my case there was no libs folder..... so i created the libs folder and then went and copied the StartAppInApp-3.1.1.jar file from a different android project i had and i pasted it to the new libs folder i made in my current project... the error is now GONE!
i also made sure to include
compile files('libs/StartAppInApp-3.1.1.jar')
in the dependencies of my app gradle file
not sure if this is a solid answer but if anyone has this problem double check your StartAppInApp-3.1.1.jar location and version and check your gradle dependencies
I installed ALL Extra and SDK API 21-22 including changed
compileSdkVersion 22 to 21 and buildToolsVersion '22.0.1' to 21.1.2.
I'm having Rendering Problems for API 22.
I have tried changing the version to <= 21 but I'm still getting an error.
These are the correct version that you can add in your build.gradle according to the API needs.
API 24:
implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:recyclerview-v7:24.2.1'
API 25:
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:recyclerview-v7:25.4.0'
API 26:
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
API 27:
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
In order to make that working I had to set:
compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")
compile ("com.android.support:design:22.2.0")
Documentation states something different (docs):
com.android.support:support-design:22.0.0
Real path for Support Repository Libraries:
You should download Support Repository Libraries.
If the problem still exists:
Go to the real path of your Support Repository Libraries and check that the following folder exists:
"ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support"
In that folder there are support libraries that can't be found.
for example:
"ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7"
Open folder appcompat-v7 and you see folders with all available version. You should use only one of these versions in the build.gradle file dependencies or use +, for ex. 18.0.+
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
}
That is the path taken from grade.build dependencies file:
com.android.support:appcompat-v7:18.0.0
Refer to the real path on your HDD -->
ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7\18.0.0
If there is no such folder, you will receive the error:
"failed to resolve com.android.support:appcompat-v7:18.0.0"
p.s. If you have Windows x64, when installing sdk and jdk, make sure that the installation path does not have Program Files(86). Brackets that add Windows may cause additional problems with resolving paths for your project. Use simple paths for your installation folder.
For example:
c:\androidSDK\
Failed to find: com.android.support:appcompat-v7:22.0.0
The "I literally tried everything else" answer:
This problem will also occur if you don't have an upto date Android Support Library and Android Support Repository. Just install using the SDK manager.
Along with other provided solutions, make sure to have the following within project/build.gradle
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
in support libraries you always need to add three numbers as version number
Suppose for 22 -> you need to write it as 22.0.0, not just 22
for 22.1 -> 22.1.0
So your dependencies should look like this
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
I Programmers language you need to pad extra zeros.
Hope this solves your problem
i solve it
change 22.0.0 to 21.0.3
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:appcompat-v7:21.0.3' }
maybe i have download the com.android.support:appcompat-v7:21.0.3 but have not got the compile 'com.android.support:appcompat-v7:22.0.0'
when i use SDK Manager update my support library and support repository , the problem dismissed.
NOTE1: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
NOTE2: Support library should not use a different version than the compileSdkVersion
For API 28 you can use:
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
https://mvnrepository.com/artifact/com.android.support/appcompat-v7/28.0.0-alpha1
https://mvnrepository.com/artifact/com.android.support/recyclerview-v7/28.0.0-alpha1
All support libraries: https://mvnrepository.com/artifact/com.android.support
It is easier to use "+" sign in the version number. For example
compile 'com.android.support:support-v4:22.0.+'
compile "com.android.support:appcompat-v7:22.0.+"
In this case you won't have to change versions for the same API number
Go to Messages Gradle Sync, and Click on Install Repository and sync project. This is will install needed file in Android SDK and after syncing you will be able to create gradle or run your project.
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Are you import them? Like this:
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")
paste the above code in your app gradle.
and while setting up the project select empty activity instead of blank activity.
Fixed my issue by changing these
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
to
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
that means your target SDK version should be same as version of cardView and recyclerView and other google libraries.
targetSdkVersion 23
Tools > Android > SDK Manager
Select all of the packages that are not up to date and update them.
I had such dependancy in build.gradle -
compile 'com.android.support:recyclerview-v7:+'
But it causes unstable builds. Ensure it works ok for you, and look in your android sdk manager for current version of support lib available, and replace this dependency with
def final RECYCLER_VIEW_VER = '23.1.1'
compile "com.android.support:recyclerview-v7:${RECYCLER_VIEW_VER}"
I solved the problem updating all packages from Android SDK Manager and also, I had to install Extras -> Android Support Repository.