1

I project targetSdkVerison version upgrade to 27, my classpath

classpath 'com.android.tools.build:gradle:2.2.2'

But when I add a dependency

compile 'com.android.support:recyclerview-v7:27.1.1'

I got this error

Could not find recyclerview-v7.jar (com.android.support:recyclerview-v7:27.1.1).
Searched in the following locations:
    https://jcenter.bintray.com/com/android/support/recyclerview-v7/27.1.1/recyclerview-v7-27.1.1.jar

Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager

I have installed the Android Support Repository,and when I click on this link

{
  "errors" : [ {
    "status" : 404,
    "message" : "Could not find resource"
  } ]
}

so I don't know how to solve it

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "XXX.XXX.XXX"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 65
        versionName "4.6"
        multiDexEnabled true;
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    configurations {
        all*.exclude group: 'com.mopub.volley'
    }

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

    lintOptions {
        abortOnError false
    }

    useLibrary 'org.apache.http.legacy'
}
repositories {
    jcenter()
    flatDir {
        dirs 'libs'
    }
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}
allprojects {
    repositories {
        mavenCentral()
    }
    sourceSets { main { java.srcDirs = ['src/main/java', 'src/test/java'] } }
}
dependencies {
    compile 'com.android.support:multidex:1.0.0'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':MaterialLibs')
    compile project(':MaterialNavigationDrawerLibs')
    compile files('libs/amazon-ads-5.6.20.jar')
    compile files('libs/AudienceNetwork.jar')
    androidTestCompile fileTree(include: ['robotium-solo-5.5.3.jar'], dir: 'libs')
    compile project(':mopub-sdk')
    testCompile 'junit:junit:4.12'
    testCompile "org.mockito:mockito-core:1.10.19"

    //add the tips
    compile 'com.android.support:design:27.1.1'
    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:recyclerview-v7:27.1.1'
    compile 'com.android.support:cardview-v7:27.1.1'

    compile 'junit:junit:4.12'
    compile files('libs/java2html.jar')
    compile files('libs/slf4j-api-1.7.7.jar')
    compile files('libs/flickrj-android-2.1.0.jar')
    compile(name: 'Common-2016.2.504-dev-release', ext: 'aar')
    compile(name: 'Chart-2016.2.504-dev-release', ext: 'aar')
    compile(name: 'Primitives-2016.2.504-dev-release', ext: 'aar')
    compile project(':draggridview')
    compile 'com.google.android.gms:play-services-ads:9.4.0'
    compile 'com.google.android.gms:play-services-appindexing:9.4.0'
    compile files('libs/libs/umeng-analytics-v6.1.2.jar')
}

When I upgraded to 'com.android.tools.build:gradle:3.1.3', It working, but Why (2.2.2) got this error

Shivam Kumar
  • 1,892
  • 2
  • 21
  • 33
Hao Li
  • 11
  • 2
  • Go to following location `File> Setting>System Settings>Android Sdk` Select `Sdk tools` tab from top and install `Android Support Repository` – Sukhbir Jul 23 '18 at 05:45
  • Add this dependency implementation `'com.android.support:recyclerview-v7:27.1.+'`. and change all the `compile` TO `implementation ` – Ali Jul 23 '18 at 06:25
  • @MohammadAli It's work after change all the 'complie' to 'implementation', but this means I have to upgraded to gradle tools version to 3+,this would cause other error,so I couldn't change my gradle tools version – Hao Li Jul 24 '18 at 01:36
  • Why not upgrading your Gradle Tool version? It's always recommended to use the latest stable version. – Raptor Jul 24 '18 at 01:57
  • @Raptor Yes I know, but my project import one libary, if I upgrad my Gradle Tool version ,It's invaliad, and the libary stop maintaining, I am looking for a new libary instead of it – Hao Li Jul 24 '18 at 02:19
  • you also update your library `gradle` same as your `gradle` it's work. @HaoLi – Ali Jul 24 '18 at 04:49

0 Answers0