Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
283 views
in Technique[技术] by (71.8m points)

android - java.lang.NullPointerException (no error message)

I know that this question of mine has been asked many times and I did follow most of the answers but none of those helped me. So this is my problem, whenever I sync my project it always fails. Here is how the gradle console look like:

Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]

Configuration on demand is an incubating feature. Incremental java compilation is an incubating feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2420Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72420Library UP-TO-DATE :app:prepareComAndroidSupportDesign2420Library UP-TO-DATE :app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72420Library UP-TO-DATE :app:prepareComAndroidSupportSupportCompat2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportCoreUi2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportCoreUtils2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportFragment2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportMediaCompat2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42420Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2420Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServices940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAds940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAdsLite940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAnalytics940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppindexing940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAppinvite940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAuth940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAuthBase940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBase940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBasement940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesCast940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesCastFramework940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesClearcut940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesContextmanager940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesDrive940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesFitness940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGames940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGass940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesGcm940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesIdentity940Library FAILURE: Build failed with an exception.

  • What went wrong: java.lang.NullPointerException (no error message)

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

BUILD FAILED

Total time: 7.518 secs

AND these are my dependencies

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'

How to resolve the issue?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I've deleted .gradle folder from the project and was able to rebuild it again.

N.B: Make a backup, just in case.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...