android - 无法访问 com.google.android.gms.tasks 的任务类文件。找不到任务

标签 android

好的,我有一个问题作为标题。它说

Error:(69, 27) error: cannot access Task class file for com.google.android.gms.tasks.Task not found

我不知道这意味着什么以及如何解决它。我几乎整天都在寻找它,但没有任何帮助。

apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            keyAlias 'key'
            keyPassword 'pass'
            storeFile file('C:/Users/Alan/Nameless_release_key.jks')
            storePassword 'pass'
        }
    }
    compileSdkVersion 26
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.sstudio.nameless"
        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'
            debuggable true
            signingConfig signingConfigs.config
        }
    }
}

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.0.2'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.firebaseui:firebase-ui-database:2.3.0'
    compile 'com.android.support:recyclerview-v7:26.0.2'
    testCompile 'junit:junit:4.12'
}



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

这是我的 gradle 控制台输出

Executing tasks: [:app:assembleDebug]

Parallel execution is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to C:\Users\Alan\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead.
The getTestClassesDir() method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the getTestClassesDirs() method instead.
The ConfigurableReport.setDestination(Object) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the method ConfigurableReport.setDestination(File) instead.
:app:buildInfoDebugLoader
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:prepareAndroidArchCoreRuntime100Alpha8Library
:app:prepareAndroidArchLifecycleExtensions100Alpha8Library
:app:prepareAndroidArchLifecycleRuntime100Alpha8Library
:app:prepareComAndroidSupportAnimatedVectorDrawable2602Library
:app:prepareComAndroidSupportAppcompatV72602Library
:app:prepareComAndroidSupportRecyclerviewV72602Library
:app:prepareComAndroidSupportSupportCompat2602Library
:app:prepareComAndroidSupportSupportCoreUi2602Library
:app:prepareComAndroidSupportSupportCoreUtils2602Library
:app:prepareComAndroidSupportSupportFragment2602Library
:app:prepareComAndroidSupportSupportMediaCompat2602Library
:app:prepareComAndroidSupportSupportV42602Library
:app:prepareComAndroidSupportSupportVectorDrawable2602Library
:app:prepareComFirebaseuiFirebaseUiDatabase230Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement1104Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks1104Library
:app:prepareComGoogleFirebaseFirebaseAnalytics1001Library
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl1001Library
:app:prepareComGoogleFirebaseFirebaseCommon1104Library
:app:prepareComGoogleFirebaseFirebaseCore1001Library
:app:prepareComGoogleFirebaseFirebaseDatabase1104Library
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection1104Library
:app:prepareComGoogleFirebaseFirebaseIid1001Library
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Parsing json file: C:\Users\Alan\Desktop\New folder\Nameless\app\google-services.json
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:javaPreCompileDebug
:app:compileDebugJavaWithJavac
C:\Users\Alan\Desktop\New folder\Nameless\app\src\main\java\com\sstudio\nameless\ChatActivity.java:69: error: cannot access Task
        me.push().setValue("online");
                          ^
  class file for com.google.android.gms.tasks.Task not found
1 error

 FAILED
:app:buildInfoGeneratorDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s

38 actionable tasks: 33 executed, 5 up-to-date

帮帮我。如果您需要更多信息,我会更新它。

最佳答案

谢谢大家的回复。现在问题消失了。 将每个依赖项 和平台插件更新到其最新版本 解决了这个问题。对于在场的所有人,永远不要……永远不要忽视更新。除非你想撞头流血。

关于android - 无法访问 com.google.android.gms.tasks 的任务类文件。找不到任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46345569/

相关文章:

java - canvas 不在 java android 中绘制

android - 设计可移动 View : Android

java - 如何将字符串转换为时区 : Android

android - 如何在用户触摸游戏对象时阻止 ARCore 模型放置?

Android:按下后退按钮时出错,即使在完成上一个 Activity 之后

android - 在 OpenGL ES 中渲染期间编译着色器是一种好的/有效的做法吗?

android - 我不明白为什么我们需要将 Android sdk 导入到项目中

android - 在 ActionBar 中将数字输入类型设置为 SearchView

java - 如果手机上未安装某些应用程序,请禁用菜单按钮?

android - 在android webview(html textarea)中禁用首字母大写