安卓工作室错误:执行任务':app:compileDebugJavaWithJavac'失败

3

我将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版本中运行得很好。


2
从项目中删除你的 .gradle 文件夹,然后重新构建它。为了以防万一,请备份文件夹。 - AskNilesh
你解决了吗? - Mohamed Nageh
2
哦,是的,如果你遇到了同样的问题,我忘记在注解处理器的上面添加实际的Glide依赖,因此它对Gradle来说是未知的。对于回答晚了很抱歉,但这个问题有点古老 :D - Boanta Ionut
2个回答

2
您没有使用注解编译相应的依赖项。
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'

将以下代码添加到您的Gradle文件中

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

谢谢,虽然我已经在4年前解决了这个问题,但这可能会帮助未来的人们。 - Boanta Ionut

0

我遇到过同样的问题。我只是移除了我添加的依赖项,我的应用程序就开始正常工作了。

您应该逐个移除库并构建应用程序。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接