Android Studio更新后出现“IDE错误”

zte4gxcn  于 2023-01-24  发布在  Android
关注(0)|答案(2)|浏览(416)

我的应用运行正常,但运行了几次之后,我的gradle构建出现了问题。(Android Studio: failed to complete gradle execution, cause is empty)我重新启动了计算机,在尝试修复该问题之前,它显示我在android studio中有一些更新。更新后,它要求我更新gradle中的一些实现版本,然后更新项目gradle中的“com.google.gms:google-services”版本。执行此操作后,我在尝试构建时收到错误消息,称“IDE error occured”。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)

项目等级:

// 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
}

模块等级:

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'

谢谢!

nlejzf6q

nlejzf6q1#

多亏了Severiano Jaramillo Quintanar的answer,我才解决了这个问题!
我面临着完全相同的问题,我担心我打破了一些东西...我修复了它的清理和重建项目(我已经禁用了即时运行建议这里之前,但我想这是没有必要的,因为我再次启用后,清理和重建项目和工作刚刚好...)。

    • 生成-〉清理项目**
    • 生成-〉重建项目**

我不确定是否有必要重建,我做了这两个步骤,它工作得很好,也许只是清理项目就足够了。
希望能有所帮助!!

    • 编辑**

很好,还有一件事。当我解决这里描述的问题时,我发现了另一个问题,当我点击运行时,APK没有被创建,我在另一个线程上用我的答案解决了它:
The APK file does not exist on disk

e3bfsja2

e3bfsja22#

在Android工作室转到文件/无效缓存。/然后选择这两个选项,并在重新启动Android工作室后重新启动你的问题就解决了

相关问题