-1

I have installed the latest version of Android Support Repository (47.0.0), but I can't build my project because of the following error.

ERROR

Here is my build.gardle code

compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
    applicationId "ir.dones.dones"
    minSdkVersion 17
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary= true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}


compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

dependencies

implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.3-alpha', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:support-compat:26.0.0'
implementation 'com.android.support:support-v4:26.0.0'
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation 'com.android.support:support-core-utils:26.0.0'
implementation 'com.android.support:design:26.0.0'
implementation 'com.android.support:support-vector-drawable:26.0.0'
implementation 'com.android.support:recyclerview-v7:26.0.0'
implementation 'com.android.support:cardview-v7:26.0.0'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation "at.blogc:expandabletextview:1.0.3"
testImplementation "junit:junit:4.12"

I have done what is suggested by Android studio to upgrade the support libraries to 26.0.2 version but as I know there is no such version released.

Android Studio suggestion

Doing so again I hit the same error.I tried google() and maven() in repositories but didn't help either. Changing support version to 26.+ is the only way I can build the project, but this way I can't use new features like fonts in Xml for Api<26.

I'm using Android studio Canary 8.

Any help would be appreciated.

Milad Moosavi
  • 1,587
  • 10
  • 20

3 Answers3

2

Check your build.gradle. You should have google repo:

allprojects {
    repositories {
        google()
        jcenter()
    }
}
DeKaNszn
  • 2,720
  • 3
  • 26
  • 26
1

It was a proxy issue after all.I had to replace the default lines in gradle.properties with this line:

org.gradle.jvmargs=-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=9090

It took me a week to find it out.thanks to those who answered or commented and tried to help.

Milad Moosavi
  • 1,587
  • 10
  • 20
0

From the error none of the libraries can be resolved. So I think the problem is with your maven not being able to get access to the repositories. This can be because of bad internet or not being configured correctly.

I would check the maven repository configurations:

allprojects {
    repositories {
        jcenter()
        mavenLocal()

or

try this:

repositories {
   jcenter {
       url "http://jcenter.bintray.com/"
   }
}
Wayne
  • 3,359
  • 3
  • 30
  • 50
  • Thanks.Let me try it with mavenLocal(). – Milad Moosavi Jul 31 '17 at 08:41
  • make sure you can access jcenter.bintray.com. And also make sure your project settings are set to use the gradle wrapper - recommended. and if that fails do a "mvn clean"/"gradle clean", sometimes this helps. And also the popular IT crowd answer - have you tried switching it on and off :-) – Wayne Jul 31 '17 at 09:18
  • :)) i've restarted my pc for about 20 times , yet didn't work.i can access jcenter(), and i am using last version of gradle wrapper .so confusing :( – Milad Moosavi Jul 31 '17 at 10:30
  • Android canary.... stay away is my advice, bleeding edge you are bound to have some problems first. But this really sounds like some miss configuration. did you try ./gradlew clean build – Wayne Jul 31 '17 at 13:34
  • I have added to my answer.. with specifying an explicit location. – Wayne Jul 31 '17 at 13:39
  • i think it's a bug of canary version, because it suggest a library that doesn't exist at all(26.0.2).i ran gradle clean but still same issue comes up.i tried maven and jcenter calling by url , both failed.i have to wait until stable version maybe – Milad Moosavi Jul 31 '17 at 18:32