【问题标题】:Unable to Run the App after Updated the PlayService Version as 12.0.0将 PlayService 版本更新为 12.0.0 后无法运行应用
【发布时间】:2018-03-22 07:03:50
【问题描述】:

在将 playservice 版本更新到 12.0.0 后尝试构建应用程序时遇到问题,但它适用于版本 11.8.0。显示应用中找不到绑定文件夹。

留言:

错误:(20, 38) 错误: com.app.test.databinding 包不存在 错误:(31, 13) 错误:找不到符号类 MainFragmentBinding

Gradle 控制台日志

Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDevDebugJavaWithJavac'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    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:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:60)

应用 Gradle

    buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

 repositories {
maven { url 'https://maven.fabric.io/public' }
 }


ext {

VERSION_BATCH_NOTIFICATION = '1.10.2'
VERSION_PARCELER = '1.1.9'
VERSION_RETROFIT = '2.3.0'
VERSION_SUPPORT_LIB = '27.1.0'
VERSION_PLAYSERVICE = '12.0.0'
VERSION_FIREBASE = '12.0.0'
SDK_MINUMUM = 17
SDK_TARGET = 27
}

android {
compileSdkVersion SDK_TARGET
//keystore configurations

defaultConfig {
    minSdkVersion SDK_MINUMUM
    targetSdkVersion SDK_TARGET
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

    }

}

flavorDimensions "environment"

//app flavors
productFlavors {
    dev {
        dimension "environment"
        applicationId "com.app.test"
          }

}

}

//data binding enables
dataBinding {
    enabled = true
}

//enabled lamda expressions
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

lintOptions {
    checkReleaseBuilds false
    // Or, if you prefer, you can continue to check for errors in release builds,
    // but continue the build even when errors are found:
    abortOnError false
}

testOptions {
    animationsDisabled = true
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

//multidex lib
implementation 'com.android.support:multidex:1.0.3'

//android support libs
implementation "com.android.support:appcompat-v7:${VERSION_SUPPORT_LIB}"
implementation "com.android.support:support-v13:${VERSION_SUPPORT_LIB}"
implementation "com.android.support:design:${VERSION_SUPPORT_LIB}"
implementation "com.android.support:cardview-v7:${VERSION_SUPPORT_LIB}"
implementation "com.android.support:recyclerview-v7:${VERSION_SUPPORT_LIB}"
implementation "com.android.support:support-v4:${VERSION_SUPPORT_LIB}"

//libs for views and layout
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.romandanylyk:pageindicatorview:1.0.0@aar'
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'

//libs for api call and image loader
implementation "com.squareup.retrofit2:retrofit:${VERSION_RETROFIT}"
implementation "com.squareup.retrofit2:converter-gson:${VERSION_RETROFIT}"
implementation "com.squareup.retrofit2:adapter-rxjava2:${VERSION_RETROFIT}"
implementation 'com.github.bumptech.glide:glide:4.5.0'

//Image picker and cropper
implementation 'com.github.esafirm.android-image-picker:imagepicker:1.12.0'
implementation 'com.github.esafirm.android-image-picker:rximagepicker:1.12.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.1', {
    exclude group: 'com.android.support', module: 'exifinterface'
}

//lib for batch notification
implementation "com.batch.android:batch-sdk:${VERSION_BATCH_NOTIFICATION}"

//parceller libs
implementation "org.parceler:parceler-api:${VERSION_PARCELER}"
annotationProcessor "org.parceler:parceler:${VERSION_PARCELER}"

//gcm
implementation "com.google.android.gms:play-services-gcm:${VERSION_PLAYSERVICE}"

//Firebase libs
implementation "com.google.firebase:firebase-messaging:${VERSION_FIREBASE}"
implementation "com.google.firebase:firebase-core:${VERSION_FIREBASE}"
implementation "com.google.firebase:firebase-auth:${VERSION_FIREBASE}"
implementation "com.google.firebase:firebase-database:${VERSION_FIREBASE}"
implementation 'com.firebase:geofire-android:2.3.0'

//lib for map
implementation "com.google.android.gms:play-services-maps:${VERSION_PLAYSERVICE}"
implementation "com.google.android.gms:play-services-location:${VERSION_PLAYSERVICE}"

//rxjava-2 libs
implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'

//language lib for managing emoji
implementation 'org.apache.commons:commons-text:1.2'

//Testing libs
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support.test.espresso:espresso-idling-resource:3.0.1'

//Crashlytics lib
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
    transitive = true;
}

}
apply plugin: 'com.google.gms.google-services'

注意 当我将 playservice 和 firebase 版本降级到 11.8.0 时,我就可以运行了

【问题讨论】:

  • @BobSnyder 如何在应用程序之前先编译项目?
  • 尝试这些步骤,删除 gradle 文件夹,清理并重新构建。此外,确保所有依赖项都具有相同的版本。希望这会有所帮助
  • 我已经尝试过了,但对我不起作用;-(
  • 谢谢大家。我已经通过将播放服务版本更新为 12.0.1 解决了这个问题

标签: android firebase gradle firebase-realtime-database


【解决方案1】:

我遇到了同样的问题(只是使用了一些 firebase 的东西,而不是数据绑定)。使用 11.8.0 但更新到 12.0.0 时不再编译。

在意识到我有一个旧版本的 play-services-auth 后,我能够修复它。这必须与 firebase-version 匹配。

当这些依赖项来自不同的模块和库时,我使用resolutionStrategy(请参阅http://stackoverflow.com/a/42718231/2170109)来克服这个问题:

project.configurations.all {
    resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.google.firebase'
                || details.requested.name.contains('play-services-auth')) {
            details.useVersion "$playServicesVersion"
        }
    }
}

【讨论】:

    【解决方案2】:

    将构建工具更新到 3.1.0 并尝试将 google() 存储库添加到项目 build.gradle:

    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.0'
        }
    }
    ...
    

    【讨论】:

    • 嗯,这对我有用,很遗憾听到它没有帮助:/
    • 感谢您的回复,12.0.1版本已解决
    【解决方案3】:

    清理并重建项目。大多数时候我这样做。它解决了所有问题。

    【讨论】:

      猜你喜欢
      • 2018-09-17
      • 2021-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-07
      • 1970-01-01
      • 1970-01-01
      • 2016-12-28
      相关资源
      最近更新 更多