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
}
}
在这里,我使用firebase和Gradle
相关库定义了play service
。以前我使用Firebase 9.0.0
版本,现在没有使用firebase密钥。所以我已经更新到新版本,然后开始遇到问题。首先我只更新了firebase
库,但错误显示为playservice
,而firebase必须保持相同的版本。问题是playservice
相关的gradle更改时间。 (错误:任务执行失败':app:processDebugGoogleServices'。
请通过更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/提供有关最新版本的信息)或将com.google.android.gms的版本更新为9.0.0来修复版本冲突。 )
答案 0 :(得分:1)
google-service插件问题是因为您使用的版本不同于firebase和google play服务:
<style type="text/css">
#area img{
position: absolute;
}
</style>
<div id="area">
</div>
<script type="text/javascript">
var pics = [
"http://fakeimg.pl/250x100/0f0000/",
"http://fakeimg.pl/250x110/110000/",
"http://fakeimg.pl/250x120/222000/",
"http://fakeimg.pl/250x130/333000/",
"http://fakeimg.pl/250x140/444000/",
"http://fakeimg.pl/150x100/555000/",
"http://fakeimg.pl/250x100/660000/",
"http://fakeimg.pl/350x100/770000/",
"http://fakeimg.pl/450x100/840000/",
"http://fakeimg.pl/250x200/990000/",
"http://fakeimg.pl/250x300/aa0000/",
"http://fakeimg.pl/250x400/bb0000/",
"http://fakeimg.pl/350x100/cc0000/",
"http://fakeimg.pl/450x100/dd0000/",
];
var img = '';
for(ii=0; ii<pics.length; ii++) {
positiontop = Math.random()*500;
positionright = Math.random()*0;
zindex = ii;
img += '<img src="'+pics[ii]+'" style="top: '+positiontop+'px;'+'right: '+positionright+'px;'+'z-index: '+zindex+';">';
}
document.getElementById('area').innerHTML= img;
</script>
它应该是:
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'
然后,您还需要将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'
移动到构建gradle的底部,如下所示:
apply plugin: 'com.google.gms.google-services'
您还需要仅使用一个版本的依赖项。在您的项目中,您正在使用:
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')