无法解决:基于播放服务-Android Studio

时间:2019-01-08 16:01:24

标签: android android-gradle android-studio-3.0

我的android studio提示我以下错误,该怎么办?

Failed to resolve: play-services-base

这是我的gradle

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
//apply plugin: 'com.jakewharton.butterknife'
repositories {
    maven { url 'https://maven.google.com' }
}
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString()
def isPlay = !(taskRequests.contains("Foss") || taskRequests.contains("foss"))
apply plugin: 'com.android.application'
if (isPlay) {
    apply plugin: 'io.fabric'
}
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "com.github.ben-manes.versions"

apply plugin: 'com.jakewharton.butterknife'

android {
    compileSdkVersion versions.compileSdk
    buildToolsVersion versions.buildTools

    defaultConfig {
        manifestPlaceholders = [onesignal_app_id               : "xxxxx",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "111"]
        applicationId "chat.almostafa.android"
        minSdkVersion versions.minSdk
        targetSdkVersion versions.targetSdk
        versionCode 10
        versionName "1.9"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

        def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
        def buildTime = new GregorianCalendar().format("MM-dd-yyyy' 'h:mm:ss a z")
        buildConfigField "String", "GIT_SHA", "\"${gitSha}\""

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }

    signingConfigs {
        release {
            storeFile project.rootProject.file('PortalAlmostafaChat.jks').getCanonicalFile()
            storePassword System.getenv("KEYSTORE_PASSWORD")
            keyAlias System.getenv("KEY_ALIAS")
            keyPassword System.getenv("KEY_PASSWORD")
        }

        debug {
            storeFile project.rootProject.file('debug.keystore').getCanonicalFile()
            storePassword "android"
            keyAlias "androiddebugkey"
            keyPassword "android"
        }
    }

    buildTypes {
        release {
            lintOptions {
                disable 'MissingTranslation'
                checkReleaseBuilds false
                // Or, if you prefer, you can continue to check for errors in release builds,
                // but continue the build even when errors are found:
                abortOnError false
            }
            buildConfigField "String", "REQUIRED_SERVER_VERSION", '"0.62.0"'
            buildConfigField "String", "RECOMMENDED_SERVER_VERSION", '"0.64.2"'
            signingConfig signingConfigs.release
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug {
            buildConfigField "String", "REQUIRED_SERVER_VERSION", '"0.62.0"'
            buildConfigField "String", "RECOMMENDED_SERVER_VERSION", '"0.64.2"'
            signingConfig signingConfigs.debug
            applicationIdSuffix ".dev"
        }
    }

    flavorDimensions "type"

    productFlavors {
        // includes proprietary libs
        play {
            dimension "type"
        }

        // only foss
        foss {
            dimension "type"
        }
    }

    packagingOptions {
        exclude 'META-INF/core.kotlin_module'
        exclude 'META-INF/main.kotlin_module'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

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

    //region MOU
    implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'com.android.support:multidex:1.0.3'

    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
    implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
    implementation 'com.netflix.rxjava:rxjava-android:0.20.3'
    implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
    implementation 'com.joanzapata.iconify:android-iconify-material:2.2.2'
    implementation 'com.joanzapata.iconify:android-iconify-material-community:2.2.2'
    implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
    implementation 'com.onesignal:OneSignal:3.+@aar'
    implementation 'com.google.firebase:firebase-messaging:17.3.0'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
    implementation 'org.greenrobot:eventbus:3.0.0'
    implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
    implementation 'org.jsoup:jsoup:1.10.1'
    implementation 'com.mindorks.android:prdownloader:0.4.0'
//    //Android-FileBrowser-FilePicker
//    implementation 'com.adityak:browsemyfiles:1.7'
    //Android-FileBrowser-FilePicker
    implementation 'com.github.jaiselrahman:FilePicker:1.1.1'
    implementation 'com.jakewharton:butterknife:9.0.0-rc3'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc3'
    kapt 'com.jakewharton:butterknife-compiler:9.0.0-rc3'
    //Architect Component
    // ViewModel and LiveData
    implementation "android.arch.lifecycle:extensions:1.1.1"
    // alternatively, just ViewModel
    implementation "android.arch.lifecycle:viewmodel:1.1.1"
    // alternatively, just LiveData
    implementation "android.arch.lifecycle:livedata:1.1.1"
    kapt "android.arch.lifecycle:compiler:1.1.1"
    // Room (use 1.1.0-alpha2 for latest alpha)
    implementation "android.arch.persistence.room:runtime:1.1.1"
    kapt "android.arch.persistence.room:compiler:1.1.1"
    //DNS
    implementation 'org.pcap4j:pcap4j-core:1.7.3'
    implementation 'org.pcap4j:pcap4j-packetfactory-static:1.7.3'
    implementation 'org.minidns:minidns-client:0.3.0'
    //endregion

    implementation project(':player')
    implementation project(':emoji')
    implementation project(':draw')
    implementation project(':util')
    implementation project(':core')
    implementation project(':suggestions')

    implementation libraries.kotlin
    implementation libraries.coroutines
    implementation libraries.coroutinesAndroid

    implementation libraries.appCompat
    implementation libraries.recyclerview
    implementation libraries.constraintlayout
    implementation libraries.cardview
    implementation libraries.browser

    implementation libraries.androidKtx
    implementation libraries.fragmentsKtx

    implementation libraries.dagger
    implementation libraries.daggerSupport
    kapt libraries.daggerProcessor
    kapt libraries.daggerAndroidApt

    implementation libraries.flexbox
    implementation libraries.material

    implementation libraries.room
    kapt libraries.roomProcessor
    implementation libraries.lifecycleExtensions
    kapt libraries.lifecycleCompiler
    implementation libraries.viewmodelKtx
    implementation libraries.workmanager

    implementation libraries.rxKotlin
    implementation libraries.rxAndroid

    implementation libraries.moshi
    implementation libraries.okhttp
    implementation libraries.okhttpLogger

    implementation libraries.timber
    implementation libraries.threeTenABP

    implementation libraries.fresco
    api libraries.frescoOkHttp
    implementation libraries.frescoAnimatedGif
    implementation libraries.frescoWebP
    implementation libraries.frescoAnimatedWebP

    implementation libraries.glide

    kapt libraries.kotshiCompiler
    implementation libraries.kotshiApi

    implementation libraries.frescoImageViewer

    implementation libraries.markwon

    implementation libraries.aVLoadingIndicatorView

    implementation libraries.livedataKtx

    implementation 'com.google.code.findbugs:jsr305:3.0.2'

    // Proprietary libraries
    playImplementation libraries.fcm
    playImplementation libraries.firebaseAnalytics
    playImplementation libraries.playServicesAuth
    playImplementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') { transitive = true }
    playImplementation('com.crashlytics.sdk.android:answers:1.4.3@aar') { transitive = true }

    testImplementation libraries.junit
    testImplementation libraries.truth
    androidTestImplementation libraries.espressoCore
    androidTestImplementation libraries.espressoIntents
}

kotlin {
    experimental {
        coroutines "enable"
    }
}

androidExtensions {
    experimental = true
}

// FIXME - build and install the sdk into the app/libs directory
// We were having some issues with the kapt generated files from the sdk when importing as a module

def sdk_location = project.properties['sdk_location'] ?: ""
task compileSdk(type: Exec) {
    if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
        commandLine 'cmd', '/c', 'build-sdk.sh', sdk_location
    } else {
        commandLine './build-sdk.sh', sdk_location
    }
}
preBuild.dependsOn compileSdk
if (isPlay) {
    apply plugin: 'com.google.gms.google-services'
}

2 个答案:

答案 0 :(得分:0)

解决了我的问题。我更新为:

implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'

答案 1 :(得分:0)

这是今天(09 / JAN / 19)的更新的gradle库,请使用它们(仅您需要的库):

implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-firestore:17.1.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-config:16.1.2'
implementation 'com.google.firebase:firebase-invites:16.0.6'
implementation 'com.google.firebase:firebase-ads:17.1.2'
implementation 'com.google.firebase:firebase-appindexing:17.1.0'
implementation 'com.google.firebase:firebase-perf:16.2.3'
implementation 'com.google.firebase:firebase-functions:16.1.3'
implementation 'com.google.firebase:firebase-ml-vision:18.0.2'
implementation 'com.google.firebase:firebase-ml-model-interpreter:16.2.4'