系统相关
首页 > 系统相关> > linux – Android Studio 3.2.1 – 无法使用gradle文件同步项目:@NotNull参数’message’的参数…不能为null

linux – Android Studio 3.2.1 – 无法使用gradle文件同步项目:@NotNull参数’message’的参数…不能为null

作者:互联网

我使用AndroidStudio时遇到问题.我刚刚将它安装在我的Kubuntu 18.04机器上,并想创建我的frist项目. Everyhting工作正常,项目开始了.唯一的问题是:我无法运行我的应用程序.我甚至无法查看设计视图中的活动 – 它将永远等待构建完成.当我想运行应用程序时,它没有任何模块.

在网络上搜索了一段时间后,我尝试将我的项目与gradle文件同步,因为这似乎解决了类似的问题,但是一旦我这样做,就会发生以下错误:

Argument for @NotNull parameter 'message' of com/android/tools/idea/gradle/project/sync/GradleSyncState.syncFailed must not be null
    java.lang.IllegalArgumentException: Argument for @NotNull parameter 'message' of com/android/tools/idea/gradle/project/sync/GradleSyncState.syncFailed must not be null
        at com.android.tools.idea.gradle.project.sync.GradleSyncState.$$$reportNull$$$0(GradleSyncState.java)
        at com.android.tools.idea.gradle.project.sync.GradleSyncState.syncFailed(GradleSyncState.java)
        at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.doPopulateProject(IdeaSyncPopulateProjectTask.java:135)
        at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.populate(IdeaSyncPopulateProjectTask.java:97)
        at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.access$000(IdeaSyncPopulateProjectTask.java:39)
        at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask$1.run(IdeaSyncPopulateProjectTask.java:86)
        at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
        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:305)
        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)

执行一次后,同步按钮被禁用,我不能再这样做了.我必须重新启动IDE才能这样做.

我查看了idea.log文件以更好地追踪问题,我在那里找到了以下内容:

2018-10-22 22:38:32,254 [d thread 3]   INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: -Didea.version=3.2 -Djava.awt.headless=true -Pandroid.injected.build.model.only=true -Pandroid.injected.build.model.only.advanced=true -Pandroid.injected.invoked.from.ide=true -Pandroid.injected.build.model.only.versioned=3 -Pandroid.injected.studio.version=3.2.1.0 -Pandroid.builder.sdkDownload=false --init-script /tmp/ijinit.gradle --offline 
2018-10-22 22:38:43,063 [d thread 3]   INFO - e.project.sync.GradleSyncState - Started setup of project 'TestApp'. 
2018-10-22 22:38:43,065 [e-1136-b06]   INFO - idea.project.IndexingSuspender - Consuming IndexingSuspender activation event: SETUP_STARTED 
2018-10-22 22:38:43,263 [e-1136-b06]   INFO - ule.android.SdkModuleSetupStep - Set Android SDK 'Android API 28 Platform (1)' (/home/myusername/Android/Sdk) to module 'app' 
2018-10-22 22:38:43,567 [d thread 3]   WARN - ea.IdeaSyncPopulateProjectTask - Sync failed: null 
java.lang.RuntimeException: java.lang.NullPointerException
    at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:179)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:651)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:656)
    at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.executeOnEdt(ExternalSystemApiUtil.java:480)
    at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.executeProjectChangeAction(ExternalSystemApiUtil.java:469)
    at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.dispose(ProjectDataManagerImpl.java:442)
    at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:163)
    at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:221)
    at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:228)
    at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.doPopulateProject(IdeaSyncPopulateProjectTask.java:120)
    at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.populate(IdeaSyncPopulateProjectTask.java:97)
    at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.access$000(IdeaSyncPopulateProjectTask.java:39)
    at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask$1.run(IdeaSyncPopulateProjectTask.java:86)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
    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:305)
    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)
Caused by: java.lang.NullPointerException
    at com.intellij.openapi.extensions.Extensions.disposeArea(Extensions.java:171)
    at com.intellij.openapi.module.impl.ModuleImpl.dispose(ModuleImpl.java:146)
    at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48)
    at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44)
    at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:169)
    at com.intellij.openapi.util.objectTree.ObjectTree.executeUnregistered(ObjectTree.java:181)
    at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:140)
    at com.intellij.openapi.util.Disposer.dispose(Disposer.java:129)
    at com.intellij.openapi.util.Disposer.dispose(Disposer.java:125)
    at com.intellij.openapi.module.impl.ModuleManagerImpl$ModuleModelImpl.dispose(ModuleManagerImpl.java:895)
    at com.intellij.openapi.externalSystem.service.project.AbstractIdeModifiableModelsProvider.dispose(AbstractIdeModifiableModelsProvider.java:476)
    at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl$3.execute(ProjectDataManagerImpl.java:445)
    at com.intellij.openapi.externalSystem.util.DisposeAwareProjectChange.run(DisposeAwareProjectChange.java:36)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1010)
    at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.lambda$executeProjectChangeAction$6(ExternalSystemApiUtil.java:469)
    at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
    at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:156)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:763)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
2018-10-22 22:38:43,570 [e-1136-b06]  ERROR - intellij.openapi.progress.Task - Argument for @NotNull parameter 'message' of com/android/tools/idea/gradle/project/sync/GradleSyncState.syncFailed must not be null 
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'message' of com/android/tools/idea/gradle/project/sync/GradleSyncState.syncFailed must not be null
    at com.android.tools.idea.gradle.project.sync.GradleSyncState.$$$reportNull$$$0(GradleSyncState.java)
    at com.android.tools.idea.gradle.project.sync.GradleSyncState.syncFailed(GradleSyncState.java)
    at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.doPopulateProject(IdeaSyncPopulateProjectTask.java:135)
    at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.populate(IdeaSyncPopulateProjectTask.java:97)
    at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.access$000(IdeaSyncPopulateProjectTask.java:39)
    at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask$1.run(IdeaSyncPopulateProjectTask.java:86)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
    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:305)
    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)
2018-10-22 22:38:43,572 [e-1136-b06]  ERROR - intellij.openapi.progress.Task - Android Studio 3.2.1  Build #AI-181.5540.7.32.5056338 
2018-10-22 22:38:43,572 [e-1136-b06]  ERROR - intellij.openapi.progress.Task - JDK: 1.8.0_152-release 
2018-10-22 22:38:43,572 [e-1136-b06]  ERROR - intellij.openapi.progress.Task - VM: OpenJDK 64-Bit Server VM 
2018-10-22 22:38:43,572 [e-1136-b06]  ERROR - intellij.openapi.progress.Task - Vendor: JetBrains s.r.o 
2018-10-22 22:38:43,572 [e-1136-b06]  ERROR - intellij.openapi.progress.Task - OS: Linux 
2018-10-22 22:38:43,572 [e-1136-b06]  ERROR - intellij.openapi.progress.Task - Last Action: Android.SyncProject

似乎项目无法同步到我的gradle文件.可能运行我的应用程序的实际问题是基于这个.有没有人之前有过这个问题,或者可以通过告诉我如何解决这个问题来帮助我?

我是AndroidStudio的新手,也是Gradle的新手.

解决方法:

好吧,我终于弄清楚了原因.

问题是,我的项目文件夹位于不同的硬盘分区上,而不是我的主文件夹.包含我的android项目的文件夹通过符号链接链接到我的主文件夹.

我无法分辨是否是导致问题的符号链接或其他分区.我没有检查过.也许它可以工作,如果你在同一个分区上,但链接到一个符号链接.也许它适用于没有符号链接的另一个分区.但对于遇到此问题的任何人 – >检查其中一个是否也是您的原因.

一些额外的信息:我的android项目文件夹位于使用ZFS格式化的硬盘分区上.

标签:linux,android-gradle,android-studio,gradle,android-studio-3-2
来源: https://codeday.me/bug/20191007/1868812.html