Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何解决android版本冲突错误?_Android_Android Studio_Service - Fatal编程技术网

如何解决android版本冲突错误?

如何解决android版本冲突错误?,android,android-studio,service,Android,Android Studio,Service,在这里,我使用firebase和play service相关库定义了Gradle。以前我使用的是Firebase 9.0.0version,现在不使用Firebase密钥。所以我已经更新到新版本,然后开始了解以下问题。首先,我只更新了firebase库,但错误显示为playservice,firebase必须保持相同的版本。问题是playservice相关的渐变时间。(错误:任务的执行失败):应用程序:ProcessDebuggGoogleServices' 请通过更新google服务插件的版本

在这里,我使用firebase和
play service
相关库定义了
Gradle
。以前我使用的是
Firebase 9.0.0
version,现在不使用Firebase密钥。所以我已经更新到新版本,然后开始了解以下问题。首先,我只更新了
firebase
库,但错误显示为
playservice
,firebase必须保持相同的版本。问题是
playservice
相关的渐变时间。(错误:任务的执行失败):应用程序:ProcessDebuggGoogleServices'

请通过更新google服务插件的版本(有关最新版本的信息,请访问)或将com.google.android.gms的版本更新为9.0.0来修复版本冲突。)


google服务插件问题是因为您在firebase和google play服务中使用的版本不同:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "xxxxxxxxxxxxxxxxxxx"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 20
        versionName '6.7'
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        useLibrary 'org.apache.http.legacy'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        dexOptions {
            javaMaxHeapSize "4g"

        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/droidText.0.2.jar')
    compile files('libs/mail.jar')
    compile files('libs/activation.jar')
    compile files('libs/additionnal.jar')
    // compile files('libs/gson-2.2.2.jar')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.android.support:recyclerview-v7:27.1.0'
    compile 'com.android.support:appcompat-v7:27.1.0'
    compile 'com.android.support:design:27.1.0'
    compile 'com.android.support:support-core-utils:27.1.0'
    compile 'com.android.support:support-compat:27.1.0'
    compile 'com.android.support:multidex:1.0.1'
    // Glide image library
    compile 'com.google.firebase:firebase-messaging:11.0.4'
    compile 'com.google.android.gms:play-services-location:11.6.0'
    compile 'com.google.android.gms:play-services-places:11.6.0'
    compile 'com.google.android.gms:play-services-maps:11.6.0'
     //implementaion 'com.google.android.gms:play-services:9.0.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
    compile 'com.wdullaer:materialdatetimepicker:2.3.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    testCompile 'junit:junit:4.12'
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    compile('org.apache.httpcomponents:httpmime:4.3') {
        exclude module: "httpclient"
    }
    compile('com.google.code.gson:gson:2.2.2') {
        exclude module: "com.google.code.gson"
    }
}
allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}
android {
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/ASL2.0'
        exclude '.idea/compiler.xml'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    defaultConfig {
        multiDexEnabled true

    }

}
应该是:

compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'com.google.android.gms:play-services-places:11.6.0'
compile 'com.google.android.gms:play-services-maps:11.6.0'
然后,您还需要将
apply插件:“com.google.gms.google services”
移动到构建梯度的底部,如下所示:

compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'com.google.android.gms:play-services-places:11.6.0'
compile 'com.google.android.gms:play-services-maps:11.6.0'

您还只需要使用一个版本的依赖项。在您的项目中,您正在使用:

apply plugin: 'com.android.application'
android {
   ...
}

   ...

dependencies {
   ...
}

apply plugin: 'com.google.gms.google-services'
这是多余的。您只需要使用一个:

compile 'com.google.code.gson:gson:2.6.2'

compile('com.google.code.gson:gson:2.2.2') {
    exclude module: "com.google.code.gson"
}
最后,您不需要添加以下内容:

compile 'com.google.code.gson:gson:2.6.2'
因为以下行已经包含了所有这些内容:

compile files('libs/droidText.0.2.jar')
compile files('libs/mail.jar')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')

如果使用targetSdkVersion=27,则必须使用版本为27的库。比如,targetSdkVersion=26,然后编译'com.android.support:appcompat-v7:26.1.0'编译'com.android.support:design:26.1.0'格式化并更正语法错误谢谢。这对我很有帮助。我开始应用插件:“com.google.gms.google services”gradle的底部它正在工作嗨,我在更新android studio(现在的android studio 3.2 Canary 7)后面临另一个问题apk proguard time显示以下警告,而不是proguard apk com.google.firebase.messaging.RemoteMessage:找不到超类或接口com.google.android.gms.common.internal.safeparcel.zza Reformation.RxSupport$1:找不到超类或接口rx.observeable$OnSubscribe Reformation.client.OkClient$1:找不到超类或接口如果问题和原因与上述问题完全不同,请创建另一个问题。顺便说一句,您应该避免使用金丝雀版本,因为它有时会引入错误。避免浪费您的时间,为您的作品使用非稳定版本。
compile fileTree(include: ['*.jar'], dir: 'libs')