我最近将谷歌服务更新为3.3.0:
classpath 'com.google.gms:google-services:3.3.0'
现在我有以下错误,google here的建议是升级到3.3.0以进行新的firebase版本控制。
这是错误:
您可以在配置阶段看到它失败。
如果我查看构建错误详细信息,请参阅以下内容:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:110)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
以下是我的项目gradle文件的详细信息:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
google()
}
//kotlin version
ext.kotlin_version = '1.2.41'
ext.kotlin_ktx_version = '0.3'
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'io.fabric.tools:gradle:1.25.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "http://dl.bintray.com/pt-midtrans/maven" }
maven { url "https://jitpack.io" }
google()
}
project.ext {
minimumSdkVersion = 16
supportlib_version = '27.1.1'
room_version = '1.0.0'
espresso_version = '3.0.1'
archLifecycleVersion = '1.1.1'
dagger = '2.15'
}
}
subprojects {
//todo change this to loop once
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$supportlib_version" //force all versions of support library to be the same. i tried commending out this entire block but that is not the issue
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
和app gradle文件:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
//buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion project.ext.minimumSdkVersion
//check top level build.gradle file for attributes -
targetSdkVersion 27
applicationId "com.mobile.mypackage"
versionCode 1
versionName "3" //whatever
testInstrumentationRunner "com.mobile.mypackage.base.MyTestRunner"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions 'tier'
buildTypes {
release {
debuggable false //for troubleshooting, should set to false in production build
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro', 'proguard-gson.pro', 'proguard-midtrans.pro'
}
debugMini {
//this is a proguarded version of debug build, turn off - InstaRun to use
initWith debug
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro', 'proguard-gson.pro', 'proguard-midtrans.pro'
matchingFallbacks = ['debug']
}
}
dexOptions {
//for out of memory gc overhead error
javaMaxHeapSize "6g"
}
lintOptions {
abortOnError false
}
androidExtensions {
experimental = true
}
testOptions {
//this seems to be absolutely nothing in build tools 25.0.3. after upgrading gradle will check again
animationsDisabled = true
execution 'ANDROID_TEST_ORCHESTRATOR'
}
productFlavors {
def STRING = "String"
def BOOLEAN = "boolean"
def TRUE = "true"
def FALSE = "false"
def BASE_ENDPOINT = "BASE_ENDPOINT"
staging {
dimension 'tier'
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
versionNameSuffix '-STAGING'
applicationIdSuffix 'staging'
}
labs {
dimension 'tier'
ext.alwaysUpdateBuildId = false
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
versionNameSuffix '-LABs'
applicationIdSuffix 'labs'
}
prod {
dimension 'tier'
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
}
}
}
kapt {
useBuildCache = false //toggle this to see if it will help
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation("com.android.support:appcompat-v7:$supportlib_version") {
force = true
}
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "com.android.support:support-annotations:$supportlib_version"
implementation("com.android.support:design:$supportlib_version") {
force = true
}
implementation 'com.android.support:multidex:1.0.3'
//firebase
implementation("com.google.firebase:firebase-core:15.0.2") {
force = true
}
implementation("com.google.firebase:firebase-auth:15.1.0") {
force = true
}
implementation("com.google.firebase:firebase-config:15.0.2") {
force = true
}
implementation("com.google.android.gms:play-services-auth:15.0.0") {
force = true
}
implementation("com.google.firebase:firebase-messaging:15.0.2") {
force = true
}
//rxjava
implementation 'io.reactivex.rxjava2:rxjava:2.1.6'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
//square
//testAnnotationProcessor "com.google.dagger:dagger-compiler:$dagger"
implementation "com.google.dagger:dagger:$dagger"
//annotationProcessor "com.google.dagger:dagger-compiler:$dagger"
kapt "com.google.dagger:dagger-compiler:$dagger"
implementation 'com.github.ajalt:timberkt:1.3.0'
implementation 'com.jakewharton:butterknife:8.8.1'
// annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation "com.squareup.retrofit2:retrofit:2.3.0"
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation "com.squareup.retrofit2:converter-gson:2.3.0"
androidTestImplementation 'com.squareup.rx.idler:rx2-idler:0.9.0' //for espresso
implementation 'com.hannesdorfmann.mosby:viewstate:2.0.1'
//------Architecture Components ------------
//room db
implementation "android.arch.persistence.room:runtime:$room_version"
//annotationProcessor "android.arch.persistence.room:compiler:$room_version"
implementation "android.arch.lifecycle:common-java8:1.1.1"
kapt "android.arch.persistence.room:compiler:$room_version"
implementation "android.arch.persistence.room:rxjava2:$room_version"
// Lifecycles only (no ViewModel or LiveData)
implementation "android.arch.lifecycle:runtime:$archLifecycleVersion"
//annotationProcessor "android.arch.lifecycle:compiler:$archLifecycleVersion"
kapt "android.arch.lifecycle:compiler:$archLifecycleVersion"
implementation "android.arch.lifecycle:extensions:$archLifecycleVersion"
//------END Architecture Components ------------
//event Bus
implementation 'org.greenrobot:eventbus:3.0.0'
//FB
implementation 'com.facebook.android:facebook-android-sdk:4.32.0'
//implementation 'com.facebook.android:facebook-applinks:[4,5)'
implementation 'com.facebook.fresco:fresco:1.3.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
//testing
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
testImplementation 'org.mockito:mockito-core:2.15.0'
androidTestImplementation 'org.mockito:mockito-android:2.8.9'
androidTestImplementation 'com.github.fabioCollini:DaggerMock:0.8.4'
implementation 'com.squareup.okhttp3:mockwebserver:3.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
// Espresso dependencies
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:$espresso_version"
// androidTestImplementation 'com.android.support.test.espresso:espresso-accessibility:3.0.1'
androidTestImplementation "com.android.support.test.espresso:espresso-web:$espresso_version"
androidTestImplementation "com.android.support.test.espresso.idling:idling-concurrent:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-idling-resource:$espresso_version"
//UI dependencies
implementation 'com.andreabaccega:android-edittext-validator:1.3.4'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation "com.imgix:imgix-java:1.1.10"
implementation 'com.github.markomilos:paginate:0.5.1'
implementation 'com.sprylab.android.texturevideoview:texturevideoview:1.2.1'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.github.d-max:spots-dialog:0.7@aar' //loading screen
implementation 'com.jaredrummler:material-spinner:1.1.0'//drop down list
implementation 'com.github.ganfra:material-spinner:1.1.1'//drop down list
implementation 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
//implementation 'com.github.takusemba:multisnaprecyclerview:1.1.1' //snap
implementation 'com.crystal:crystalrangeseekbar:1.1.1'
implementation 'com.github.faruktoptas:FancyShowCaseView:1.0.0'
//data structures
implementation 'com.scalified:tree:0.2.4'
//parcelable
implementation 'org.parceler:parceler-api:1.1.9'
//annotationProcessor 'org.parceler:parceler:1.1.9'
kapt 'org.parceler:parceler:1.1.9'
//payment gateways
//implementation 'co.omise:omise-android:2.3.+'
implementation 'co.omise:omise-android:2.6.4'
implementation 'com.braintreepayments.api:braintree:1.+'
debugImplementation 'com.midtrans:uikit:1.17.0-SANDBOX'
debugMiniImplementation 'com.midtrans:uikit:1.17.0-SANDBOX'
releaseImplementation 'com.midtrans:uikit:1.17.0'
//fresh chat
implementation 'com.github.freshdesk:freshchat-android:1.3.1'
implementation'com.crashlytics.sdk.android:crashlytics:2.9.2'
//one signal
implementation 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
//retrofit pretty logs
implementation('com.github.ihsanbal:LoggingInterceptor:2.0.2') {
exclude group: 'org.json', module: 'json'
}
//barcode scanner
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
//masking text
implementation 'com.redmadrobot:inputmask:2.3.0'
// Analytics
implementation "com.google.android.gms:play-services-analytics:15.0.2"
implementation 'com.appsflyer:af-android-sdk:4+@aar'
implementation 'com.android.installreferrer:installreferrer:1.0'
//runtime permissions
implementation 'com.karumi:dexter:4.2.0'
//chrome custom tabs
implementation 'saschpe.android:customtabs:1.0.9'
//searching - https://github.com/algolia/algoliasearch-client-android/releases
implementation 'com.algolia:algoliasearch-android:3.21.11'
//credit card scanner
implementation 'io.card:android-sdk:5.5.1'
//firebase test orchestrator
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestUtil 'com.android.support.test:orchestrator:1.0.2'
//kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
//kotlin ktx
implementation "androidx.core:core-ktx:$kotlin_ktx_version"
}
apply plugin: 'com.google.gms.google-services' //add to bottom of file
如果我降级到3.2.1,我会收到以下构建错误:
5 [ERROR] [com.android.build.gradle.internal.transforms.DesugarTransform] Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:483)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:331)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:91)
at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:112)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:702)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)
更新:
降级到谷歌服务3.2.1后我在构建gradle项目时遇到以下错误:
14:37:49.269 [ERROR] [com.android.build.gradle.internal.transforms.DesugarTransform] Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:483)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:331)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:91)
at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:112)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:702)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)
更新:似乎禁用oneSignal Sdk时,deSugar错误在3.2.0上消失。所以我推测这必须与firebase版本控制有关。但使用3.3.0仍然存在问题。我将单独联系oneSignal。
我不知道如何解决这个问题。我正在使用4.6并尝试了4.4 gradle包装器(以防万一)。
答案 0 :(得分:2)
使用classpath' com.google.gms:google-services:3.2.0'