我的应用程序工作正常但运行了几次后我得到了gradle构建的问题。 (Android Studio: failed to complete gradle execution, cause is empty)我重新启动了我的电脑,在尝试修复问题之前,它向我展示了我在android studio中有一些更新。更新后,它要求我更新gradle中的某些实现版本,然后更新项目gradle中的“com.google.gms:google-services”版本。执行此操作后,我在尝试执行构建时收到错误消息“IDE发生错误”。 Android支持插件中出现例外情况。
例外情况:
null
java.lang.NullPointerException
at com.android.tools.idea.run.tasks.InstantRunNotificationTask.<init>(InstantRunNotificationTask.java:64)
at com.android.tools.idea.fd.InstantRunBuildAnalyzer.getNotificationTask(InstantRunBuildAnalyzer.java:188)
at com.android.tools.idea.run.AndroidLaunchTasksProvider.getTasks(AndroidLaunchTasksProvider.java:122)
at com.android.tools.idea.run.LaunchTaskRunner.run(LaunchTaskRunner.java:102)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:713)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:543)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:165)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:315)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.1' // google-services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com" // Google's Maven repository
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
模块gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'com.example.elaymac.randochat'
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation 'com.google.firebase:firebase-storage:12.0.1'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.firebaseui:firebase-ui-database:3.3.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
谢谢!
答案 0 :(得分:0)
感谢Severiano Jaramillo Quintanar answer解决了这个问题!
我遇到了同样的问题,我害怕我弄错了......我 通过清理和重建项目来修复它(我已经禁用了 按照之前的建议立即运行,但我想那不是 必要的,因为我在清洁和重建后再次启用它 项目和工作得很好......)。
构建 - &gt;清洁项目
构建 - &gt;重建项目
我不确定是否需要重建,我做了两个步骤 它工作得很好,也许只是清理项目本来就是 足够的。
希望有所帮助!!
修改强>
很好,还有一件事。当我解决了这里描述的问题时,我发现了 另一个问题,当我点击运行apk没有被创建和 我用另一个帖子的答案解决了这个问题: