首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >java.lang.NullPointerException (无错误消息)

java.lang.NullPointerException (无错误消息)
EN

Stack Overflow用户
提问于 2016-08-28 01:06:12
回答 15查看 89.3K关注 0票数 87

我知道我的这个问题已经被问了很多次了,我确实遵循了大多数答案,但这些答案都对我没有帮助。所以这就是我的问题,每当我同步我的项目时,它总是失败。下面是gradle控制台的外观:

执行任务::app:generateDebugSources,:app:generateDebugAndroidTestSources,:app:mockableAndroidJar,:app:prepareDebugUnitTestDependencies

按需配置是一种孵化功能。增量java编译是一个孵化特征。用法:app:preBuild最新:app:preDebugBuild最新:app:checkDebugManifest :app:preReleaseBuild构建最新的:app:prepareComAndroidSupportAnimatedVectorDrawable2420Library最新的:app:prepareComAndroidSupportAppcompatV72420Library最新的:app:prepareComAndroidSupportDesign2420Library最新的:app:prepareComAndroidSupportMediarouterV72300Library最新的:app:prepareComAndroidSupportRecyclerviewV72420Library最新的:app:prepareComAndroidSupportSupportCompat2420Library最新的:app:prepareComAndroidSupportSupportCoreUi2420Library最新的:app:prepareComAndroidSupportSupportCoreUtils2420Library :app:prepareComAndroidSupportSupportFragment2420Library UP-最新:app:prepareComAndroidSupportSupportMediaCompat2420Library最新:app:prepareComAndroidSupportSupportV42420Library最新:app:prepareComAndroidSupportSupportVectorDrawable2420Library最新:app:prepareComGoogleAndroidGmsPlayServices940Library最新:app:prepareComGoogleAndroidGmsPlayServicesAds940Library最新:app:prepareComGoogleAndroidGmsPlayServicesAdsLite940Library最新:app:prepareComGoogleAndroidGmsPlayServicesAnalytics940Library最新:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl940Library最新:app:prepareComGoogleAndroidGmsPlayServicesAppindexing940Library最新:app:prepareComGoogleAndroidGmsPlayServicesAppinvite940Library最新:app:prepareComGoogleAndroidGmsPlayServicesAuth940Library:app:prepareComGoogleAndroidGmsPlayServicesAuthBase940Library最新:app:prepareComGoogleAndroidGmsPlayServicesBase940Library最新:app:prepareComGoogleAndroidGmsPlayServicesBasement940Library最新:app:prepareComGoogleAndroidGmsPlayServicesCast940Library最新:app:prepareComGoogleAndroidGmsPlayServicesCastFramework940Library最新:app:prepareComGoogleAndroidGmsPlayServicesClearcut940Library最新:app:prepareComGoogleAndroidGmsPlayServicesContextmanager940Library最新:app:prepareComGoogleAndroidGmsPlayServicesDrive940Library最新:app:prepareComGoogleAndroidGmsPlayServicesFitness940Library最新:app:prepareComGoogleAndroidGmsPlayServicesGames940Library最新:app:prepareComGoogleAndroidGmsPlayServicesGass940Library最新:app:prepareComGoogleAndroidGmsPlayServicesGcm940Library最新:app:prepareComGoogleAndroidGmsPlayServicesIdentity940Library失败:生成失败,出现异常。

堆栈跟踪错误: java.lang.NullPointerException (无错误消息)

  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。

构建失败

总时间: 7.518秒

这些是我的依赖项

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'
    })
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.android.support:design:24.2.0'
    compile 'com.google.android.gms:play-services:9.4.0'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services-location:9.4.0'
    compile 'com.google.android.gms:play-services-appindexing:9.4.0'
    compile 'com.google.firebase:firebase-messaging:9.2.0'
    compile 'com.google.firebase:firebase-database:9.0.2'
    compile 'com.firebase:firebase-client-android:2.4.0'
    compile 'com.google.firebase:firebase-core:9.4.0'
}

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

如何解决这个问题?

EN

回答 15

Stack Overflow用户

回答已采纳

发布于 2016-09-02 05:54:07

我已经从项目中删除了.gradle文件夹,并且能够重新构建它。

注意:做个备份,以防万一。

票数 201
EN

Stack Overflow用户

发布于 2016-10-07 22:53:37

当系统突然重启,然后gradle文件损坏时,就会出现这个问题。以及缓存的损坏文件,因此我们需要从您的项目中删除此文件

your_project_path/.gradle/2.14.1/taskArtifacts

它将再次重新生成。

然后重新启动Android studio并重新编译项目。

来源:https://code.google.com/p/android/issues/detail?id=220741#c13

这对我来说很有效。

票数 30
EN

Stack Overflow用户

发布于 2017-05-14 21:48:42

如果你仍然有这个问题,即使在删除项目路径下的.gradle文件夹后,按照建议的above杀死在任务管理器上运行的所有Java进程,并尝试更新您的Android Studio

我也在同样的情况下,但现在它工作得很好。

希望它能帮上忙!

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39183674

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档