1

I a trying to use the EmojiCompat support library in my Android app. When i add -com.android.support:support-emoji:26.1.0 - as a dependency in app module gradle and try to sync it, i get below error -

Error:(31, 13) Failed to resolve: com.android.support:support-emoji:26.1.0

Below is my build.gradle(project module)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // 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
}

gradle.script(app module) below -

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "example.example.com.emojis2"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    //adding lib

    compile 'com.android.support:support-emoji:26.1.0'
}

What am i missing , can someone please help ! Thanks in advance ...

Paathak Kumar
  • 65
  • 1
  • 8
  • @Gabriele - This is not a duplicate question. In the question , which you are referring to , the library is different than the one mentioned here. – Paathak Kumar Oct 16 '17 at 03:29
  • The same answer is valid for all support libraries. – Gabriele Mariotti Oct 16 '17 at 05:38
  • add *google()* like this in *PROJECT LEVEL GRADLE* like this `buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0-alpha9' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }` – KuLdip PaTel Oct 16 '17 at 05:48

1 Answers1

0

Error:(31, 13) Failed to resolve: com.android.support:support-emoji:26.1.0

You should add this in your PROJECT LEVEL build.gradle section .

 allprojects {
        repositories {
            jcenter()
            maven { url 'https://maven.google.com' }
        }
    }

DEMO

buildscript {
    repositories {
        jcenter()
         // You need to add the following repository to download the new plugin.
         maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3' 

    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
}

FYI

To add them to your build, you need to first include Google's Maven repository in your top-level build.gradle file:

allprojects {
    repositories {
        google()

        // If you're using a version of Gradle lower than 4.1, you must instead use:
        // maven {
        //     url 'https://maven.google.com'
        // }
        // An alternative URL is 'https://dl.google.com/dl/android/maven2/'
    }
}
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198