无法将EmojiCompat库(com.android.support:support-emoji:26.1.0)添加到我的应用程序gradle

时间:2017-10-15 17:35:14

标签: android emoji

我试图在我的Android应用中使用EmojiCompat支持库。当我添加-com.android.support:support-emoji:26.1.0 - 作为app模块gradle中的依赖项并尝试同步它时,我得到以下错误 -

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

下面是我的build.gradle(项目模块)



// 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模块) -



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




我缺少什么,有人可以帮忙!提前谢谢......

1 个答案:

答案 0 :(得分:1)

  

错误:(31,13)无法解决:   com.android.support:support-emoji:26.1.0

您应该在 PROJECT LEVEL final Uri taskUri = getIntent().getData(); if(taskUri == null) { throw new NullPointerException("Sorry, the URI has not been set"); } 部分添加此内容。

build.gradle

<强>样本

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

<强> FYI

要将它们添加到您的构建中,您需要先在 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' } } } 文件中包含 Google's Maven repository

build.gradle