Не удалось разрешить все зависимости Google - PullRequest
0 голосов
/ 29 июня 2018

Я открыл свой рабочий проект на моем персональном компьютере, и сборка Gradle не удается разрешить все зависимости от Google (поддержка libs, firebase, gms и т. Д.), В моих файлах Gradle есть как google(), так и url "https://maven.google.com", я фактически помещаю их в любое место, которое я мог найти после нескольких попыток выяснить, что не так. Gradle дает мне эту ошибку

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, если они кому-нибудь понадобятся, есть идеи, что это может быть? другие мои проекты работают нормально, только у этого есть некоторые проблемы. Также вчера на моем рабочем компьютере все работало нормально, и никаких изменений в коде между

не было.

EDIT

build.gradle (проект: MyApp)

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 (Модуль: приложение)

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 (Модуль: other_moduke)

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

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'

Ответы [ 3 ]

0 голосов
/ 29 июня 2018

Обновление Службы Google с:

classpath 'com.google.gms:google-services:3.2.1'

Кому:

classpath 'com.google.gms:google-services:4.0.1'
0 голосов
/ 09 июля 2018

После нескольких попыток я решил эту проблему путем переустановки всей студии Android, что-то не так с моим локальным gradle (может быть, достаточно только удалить .gradle из / AppData или что-то подобное). После открытия проекта в переустановленной Android Studio все работает нормально.

0 голосов
/ 29 июня 2018

На самом деле вы должны иметь jcenter(). Например, мой Gradle верхнего уровня выглядит так:

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: ваш код:

implementation "com.android.support:cardview-v7:${supportLibVersion}"

где ваша supportLibVersion переменная?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...