我遇到了这个 google play services 插件的问题。它告诉我从当前版本更新到以前的版本。我在这里查看了其他线程,他们都说将插件放在基于应用程序的 gradle 的末尾,我已经这样做了,但我仍然收到错误。
这是我的 list 代码:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mikediloreto.findingrestaurants">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".MyApplication"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ProfileActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
这是基于应用程序的 gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.mikediloreto.findingrestaurants"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-auth:9.2.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-maps:11.0.4'
}
apply plugin: 'com.google.gms.google-services'
这是基于项目的构建gradle:
//顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
如果您希望我包含任何其他代码,请告诉我。
最佳答案
首先这是你不应该做的事情
compile 'com.google.android.gms:play-services-maps:11.0.4'
和
compile 'com.google.android.gms:play-services-auth:9.2.1'
对具有相同版本的库的全局变量具有良好的做法
然后你可以做类似的事情
compile "com.google.android.gms:play-services-auth:$google_ver"
可能是 11.xxx 和 9.xxx 版本造成了麻烦。尝试使用 11.0.4 而不是 9.2.1
关于android - 即使当前版本是 9.2.1,Google Play 服务也会更新到 9.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47642390/