【发布时间】:2017-01-04 03:39:05
【问题描述】:
我知道我的这个问题已经被问过很多次,并且我确实遵循了大多数答案,但没有一个对我有帮助。所以这是我的问题,每当我同步我的项目时,它总是失败。下面是 gradle 控制台的样子:
执行任务:[:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
按需配置是一项孵化功能。增量java 编译是一个孵化功能。 :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2420Library 最新:app:prepareComAndroidSupportAppcompatV72420Library 最新:app:prepareComAndroidSupportDesign2420Library 最新 :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 最新: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'
如何解决问题?
【问题讨论】:
-
我刚才遇到了同样的问题。构建 -> 清理项目,然后重新运行对我有用。
-
有时 Android Studio 无法识别类似的错误。 1.error sintaxis, 2.resources not found, 3.changes in code.. and others..我的case有没有找到改变..
-
@marlonpya 看看here,问题很可能是 gradle.properties。
-
每次我更新 Android Studio 时,都会发生这种奇怪的事情。 w3bshark 的干净构建对我有用。
-
刚刚重启 android studio 解决了我的问题
标签: android gradle build.gradle