【问题标题】:Android Studio Error:Execution failed for task ':app:compileDebugJavaWithJavac'Android Studio 错误:任务“:app:compileDebugJavaWithJavac”执行失败
【发布时间】:2017-06-12 07:46:34
【问题描述】:

我将 Android Studio 和 SDK 工具更新到了最新版本,现在我收到了这个错误。我已经相应地更新了 Google 服务和 firebase 依赖项。我试图清理和重建项目,但结果是一样的。

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.NullPointerException: element == null

这是我的 gradle 构建:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
    applicationId "com.crisser.beitnaonline"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
compile('com.android.support:cardview-v7:23.2.0') {
    force = true
}
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-database:11.0.0'
compile 'com.google.firebase:firebase-auth:11.0.0'
compile 'com.google.firebase:firebase-core:11.0.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 
'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.appolica:interactive-info-window:v1.0.6'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'
}
apply plugin: 'com.google.gms.google-services'

有人知道它为什么会这样吗?它在 25.0.3 上运行良好。

【问题讨论】:

  • 从项目中删除您的 .gradle 文件夹并能够再次重建它。做好备份,以防万一。
  • 你解决了吗?
  • 哦,是的,如果你有同样的问题,我忘了在 annotationProcessor 上方添加 glide 的实际依赖项,所以 Gradle 是未知的,抱歉迟到的答案,但问题有点老了: D

标签: android android-studio gradle


【解决方案1】:

你没有用注解编译对应的依赖

annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'

将此添加到您的 gradle 文件中

compile 'com.github.bumptech.glide:glide:4.0.0'

【讨论】:

  • 谢谢,尽管我在 4 年前就解决了这个问题,但这可能会对未来的人们有所帮助
【解决方案2】:

我也遇到过同样的问题。我刚刚删除了我添加的依赖项,我的应用开始正常工作。

你应该一个一个删除库并构建应用程序..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-01
    • 2016-01-08
    • 1970-01-01
    • 2017-09-13
    • 2020-03-29
    • 1970-01-01
    • 2021-05-22
    相关资源
    最近更新 更多