首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未能解决所有Google依赖项

未能解决所有Google依赖项
EN

Stack Overflow用户
提问于 2018-06-29 11:19:29
回答 3查看 1.3K关注 0票数 0

我在我的个人电脑上打开了我的工作项目,而Gradle构建在解决所有谷歌依赖(支持库、firebase、gms等)方面失败了,我在我的gradle文件中有google()url "https://maven.google.com",在多次尝试找出出了什么问题之后,我实际上把我能找到的任何地方都放进去了。Gradle给了我这个错误

代码语言:javascript
复制
Failed to resolve: cardview-v7
Open File

Failed to resolve: design
Open File

Failed to resolve: recyclerview-v7
Open File

Failed to resolve: percent
Open File

Failed to resolve: play-services-maps
Open File

Failed to resolve: firebase-messaging
Open File

Failed to resolve: firebase-invites
Open File

Failed to resolve: play-services-appinvite
Open File

Failed to resolve: firebase-analytics
Open File

Failed to resolve: firebase-iid-interop
Open File

Failed to resolve: firebase-common
Open File

Failed to resolve: play-services-tasks
Open File

Failed to resolve: firebase-measurement-connector
Open File    

Failed to resolve: play-services-stats
Open File    

Failed to resolve: support-v4
Open File

Failed to resolve: transition
Open File

Failed to resolve: appcompat-v7
Open File    

Failed to resolve: support-fragment
Open File

Failed to resolve: animated-vector-drawable
Open File

Failed to resolve: support-core-ui
Open File

Failed to resolve: support-vector-drawable
Open File

Failed to resolve: support-annotations
Open File

如果有人需要,我会把我的gradle文件发出去,知道这可能是什么吗?我的其他项目运行良好,只有这个有一些问题。昨天,在我的工作计算机上,一切正常工作,在

编辑

build.gradle (计划:MyApp)

代码语言:javascript
复制
apply plugin: 'com.github.ben-manes.versions'

buildscript {
    ext.kotlin_version = '1.2.30'
    repositories {
        jcenter()
        google()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'

        classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
        classpath "io.realm:realm-gradle-plugin:4.3.0"
        classpath 'com.google.gms:google-services:3.2.1'


        classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle (模块:app)

代码语言:javascript
复制
buildscript {
        repositories {
            jcenter()
            google()
            maven {
                url 'https://maven.fabric.io/public'
            }
        }

        dependencies {
            classpath 'io.fabric.tools:gradle:1.+'
        }
    }

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
apply from: '../dependencies.gradle'


android {

    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.app.app"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 30

        versionName "1.2.2"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        signingConfig signingConfigs.config
    }
    buildTypes {
        debug {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    lintOptions {
        abortOnError false
    }
    testOptions {
        unitTests.returnDefaultValues = true
    }
    packagingOptions {
        // Remove unneeded Realm native libs (nearly no devices use these)
        exclude 'lib/mips/librealm-jni.so'
        // comment the following line out and clean project, if you want to
        // test the app in an emulator/x86 device
        //exclude 'lib/x86/librealm-jni.so'
        //exclude 'lib/x86_64/librealm-jni.so'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }
}


repositories {
    jcenter()
    google()
    maven { url 'https://jitpack.io' }
    maven { url 'https://maven.fabric.io/public' }

    maven {
        url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
    }
    maven {
        url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
    }
    maven { url "https://api.bitbucket.org/1.0/repositories/touchartsro/maven-public/raw/releases" }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:multidex:1.0.3'
    annotationProcessor "com.google.dagger:dagger-compiler:${daggerVersion}"
    implementation "com.google.dagger:dagger:${daggerVersion}"    

    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    implementation "com.android.support:cardview-v7:${supportLibVersion}"
    implementation "com.android.support:appcompat-v7:${supportLibVersion}"
    implementation "com.android.support:cardview-v7:${supportLibVersion}"
    implementation "com.android.support:recyclerview-v7:${supportLibVersion}"
    implementation "com.android.support:design:${supportLibVersion}"
    implementation "com.android.support:percent:${supportLibVersion}"
    implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
    implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
    implementation "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}"
    implementation "com.squareup.okhttp3:okhttp:${okHttpVersion}"
    implementation "com.squareup.okhttp3:logging-interceptor:${okHttpVersion}"
    implementation 'io.realm:android-adapters:2.1.0'
    implementation "org.parceler:parceler-api:${parcelerVersion}"
    annotationProcessor "org.parceler:parceler:${parcelerVersion}"
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') {
        transitive = true;
    }
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.jakewharton.timber:timber:4.6.0'
    implementation 'io.jsonwebtoken:jjwt:0.7.0'
    implementation('io.socket:socket.io-client:1.0.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }
    implementation 'io.reactivex:rxjava:1.2.1'
    implementation 'io.reactivex:rxandroid:1.2.1'
    implementation 'io.reactivex:rxjava-async-util:0.21.0'
    implementation 'com.jakewharton.rxbinding:rxbinding:0.3.0'
    implementation 'com.trello:rxlifecycle:0.4.0'
    implementation 'com.trello:rxlifecycle-components:0.4.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.23.0'
    implementation 'org.twitter4j:twitter4j-core:4.0.4'
    implementation 'com.facebook.stetho:stetho:1.4.1'
    implementation 'com.uphyca:stetho_realm:2.1.0'
    implementation 'com.facebook.fresco:fresco:1.8.1'
    implementation 'com.facebook.fresco:animated-gif:1.5.0'
    implementation 'com.facebook.fresco:animated-webp:1.5.0'
    implementation 'com.facebook.fresco:webpsupport:1.5.0'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.firebase:firebase-invites:16.0.0'
    implementation 'net.danlew:android.joda:2.9.9'
    implementation 'com.aurelhubert:ahbottomnavigation:2.2.0'
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
    implementation 'org.sufficientlysecure:html-textview:3.5'
    implementation 'com.github.mukeshsolanki:country-picker-android:1.1.9'
    implementation 'net.opacapp:multiline-collapsingtoolbar:1.5.0'
    implementation 'me.zhanghai.android.materialratingbar:library:1.1.0'
    implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
    implementation 'me.postaddict:instagramscraper:1.0.0'


    implementation project(':card-fold')

    //implementation project(':fcell')
    //implementation project(':kotlin-utils')

    implementation 'cz.touchart:kotlin-utils:0.1.6'

    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    compileOnly 'javax.annotation:jsr250-api:1.0'
}

apply plugin: 'com.google.gms.google-services'

build.gradle (Module:other_moduke)

代码语言:javascript
复制
buildscript {
    repositories {

        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()

    }
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: '../dependencies.gradle'

android {
    compileSdkVersion 27

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
}

dependencies.gradle

代码语言:javascript
复制
ext.kotlinVersion = '1.2.30'
ext.supportLibVersion = '27.1.0'

ext.retrofitVersion = '2.3.0'
ext.okHttpVersion = '3.8.1'
ext.daggerVersion = '2.11'
ext.parcelerVersion = '1.1.9'
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2018-07-09 10:10:37

经过多次尝试,我在重新安装整个Android时解决了这个问题,我的本地gradle出现了问题(可能只从/AppData中删除/AppData或类似的东西就足够了)。在重新安装的Android中打开项目后,所有工作都正常。

票数 0
EN

Stack Overflow用户

发布于 2018-06-29 11:26:08

实际上,你也必须拥有jcenter()。例如,我的顶级看起来如下:

代码语言:javascript
复制
buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

根据您的等级编辑:

不要将依赖项放在build.gradle (Project:MyApp)中。它们必须只在模块中。把他们移到build.gradle (Module:app)

编辑2:您的代码:

代码语言:javascript
复制
implementation "com.android.support:cardview-v7:${supportLibVersion}"

您的supportLibVersion变量在哪里?

票数 0
EN

Stack Overflow用户

发布于 2018-06-29 13:19:18

更新google服务

代码语言:javascript
复制
classpath 'com.google.gms:google-services:3.2.1'

至:

代码语言:javascript
复制
classpath 'com.google.gms:google-services:4.0.1'
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51100575

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档