bra*_*ker 67 android gradle build.gradle
我正在关注此链接以在我的Android应用中集成Google登录.https://developers.google.com/identity/sign-in/android/start-integrating 如上面给定页面的最后一步所示,我们必须包含依赖项
compile 'com.google.android.gms:play-services-auth:8.3.0'
Run Code Online (Sandbox Code Playgroud)
在app-level build.gradle文件中,但这样做并构建项目错误来说
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
Run Code Online (Sandbox Code Playgroud)
的build.gradle(模块:APP)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.brainbreaker.socialbuttons"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.android.gms:play-services-auth:8.3.0'
}
Run Code Online (Sandbox Code Playgroud)
在build.gradle文件中,编译依赖行compile 'com.google.android.gms:play-services-auth:8.3.0'显示错误
所有com.google.android.gms库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃).找到版本8.3.0,8.1.0.示例包括com.google.android.gms:play-services-base:8.3.0和com.google.android.gms:play-services-measurement:8.1.0有一些库,工具和库的组合,是不兼容的,或可能导致错误.一个这样的不兼容性是使用不是最新版本的Android支持库版本(或者特别是低于targetSdkVersion的版本)进行编译.
以下是gradle构建的消息.
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :social_buttons:generateDebugSources, :social_buttons:generateDebugAndroidTestSources, :social_buttons:compileDebugSources, :social_buttons:compileDebugAndroidTestSources]
:clean UP-TO-DATE
:app:clean
:social_buttons:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportDesign2301Library
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
:app:processDebugGoogleServices FAILED
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
Information:BUILD FAILED
Information:Total time: 3.49 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Run Code Online (Sandbox Code Playgroud)
我无法看到这个版本冲突的任何出路.任何帮助表示赞赏.
sey*_*eon 158
我有同样的问题.但现在我已经修好了.
你应该删除一行 apply plugin: 'com.google.gms.google-services'
因为"com.android.application"包已经有相同的包.
sco*_*yab 15
我发现同样的错误抱怨在从8.3切换到8.4时混合谷歌播放服务版本.奇怪的是,我看到了我没有使用的app-measurement lib的参考.
我想也许我的应用程序的一个依赖项引用了旧版本,所以我跑去./gradlew app:dependencies查找有问题的库(非是).
但在任务输出的顶部,我发现了一条错误消息,指出无法找到谷歌插件并默认为谷歌播放服务8.3.我使用示例项目 @TheYann链接进行比较.我的设置是相同的,除了我apply plugin: 'com.google.gms.google-services'在我的应用程序的build.gradle文件的顶部应用.我移动到文件的底部,并修复了gradle编译错误.
defaultConfig在Android/app/build.gradle为 Flutter 应用程序连接 Firebase 后,确保您已经完成了这两件事。
1) 无论您在创建 Firebase android 项目时输入什么包名称,都应该与您applicationId在defaultConfig.
2)multiDexEnabled true在defaultConfig.
所以defaultConfig{}现在应该看起来像这样
defaultConfig {
applicationId "com.companyName.appName"
minSdkVersion 16
targetSdkVersion 27
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
96315 次 |
| 最近记录: |