繁体   English   中英

Android Studio 构建项目的时间过长并发生错误

[英]Android Studio takes too long to build the project and error occurred

我刚刚打开了一个项目,它弹出了堆栈跟踪。 在那之后,我一直在等待构建完成,但花了很长时间(超过 4 个小时)。 我在 1 个月前打开了同一个项目,没有任何问题,但我不确定问题出在哪里。

堆栈跟踪:

java.lang.IllegalStateException: @NotNull method com/android/tools/idea/gradle/project/model/AndroidModuleModel.getRootDir must not return null
    at com.android.tools.idea.gradle.project.model.AndroidModuleModel.$$$reportNull$$$0(AndroidModuleModel.java)
    at com.android.tools.idea.gradle.project.model.AndroidModuleModel.getRootDir(AndroidModuleModel.java:571)
    at com.android.tools.idea.gradle.project.sync.setup.module.android.ContentRootsModuleSetupStep.findContentEntries(ContentRootsModuleSetupStep.java:71)
    at com.android.tools.idea.gradle.project.sync.setup.module.android.ContentRootsModuleSetupStep.doSetUpModule(ContentRootsModuleSetupStep.java:58)
    at com.android.tools.idea.gradle.project.sync.setup.module.android.ContentRootsModuleSetupStep.doSetUpModule(ContentRootsModuleSetupStep.java:41)
    at com.android.tools.idea.gradle.project.sync.setup.module.ModuleSetupStep.setUpModule(ModuleSetupStep.java:35)
    at com.android.tools.idea.gradle.project.sync.setup.module.common.BaseSetup.setUpModule(BaseSetup.java:41)
    at com.android.tools.idea.gradle.project.sync.ng.ModuleSetup.setupModuleModels(ModuleSetup.java:141)
    at com.android.tools.idea.gradle.project.sync.ng.CachedProjectModelsSetup.setUpModules(CachedProjectModelsSetup.java:116)
    at com.android.tools.idea.gradle.project.sync.ng.ProjectSetup$ProjectSetupImpl.setUpProject(ProjectSetup.java:82)
    at com.android.tools.idea.gradle.project.sync.ng.SyncResultHandler.onSyncSkipped(SyncResultHandler.java:164)
    at com.android.tools.idea.gradle.project.sync.ng.NewGradleSync.trySyncWithCachedGradleModels(NewGradleSync.java:219)
    at com.android.tools.idea.gradle.project.sync.ng.NewGradleSync.sync(NewGradleSync.java:165)
    at com.android.tools.idea.gradle.project.sync.ng.NewGradleSync.access$000(NewGradleSync.java:59)
    at com.android.tools.idea.gradle.project.sync.ng.NewGradleSync$2.run(NewGradleSync.java:151)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:736)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
    at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
    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)

尝试 File-> Invalidate Caches/Restart,它对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM