Android Studio在启动时突然崩溃

时间:2017-05-29 10:06:14

标签: java android android-studio android-studio-2.3

我没有使用Android Studio 2.3.2 3天或4天,当我尝试启动它时突然发现下面的错误。请注意,我在一周前单独安装了Android Studio 3.0 Canary 1,但一切都很好,两个版本都没有问题。我不明白为什么我突然遇到启动Android Studio的问题。

我使用的是MacBook。

以下是Android Studio在发布时提供的错误日志:

Internal Error. Please report to https://code.google.com/p/android/issues

java.lang.RuntimeException: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.android.tools.idea.AndroidInitialConfigurator'
    at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:203)
    at com.intellij.idea.MainImpl$1.lambda$null$0(MainImpl.java:47)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:358)
    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)
Caused by: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.android.tools.idea.AndroidInitialConfigurator'
    at com.intellij.ide.plugins.PluginManager.handleComponentError(PluginManager.java:248)
    at com.intellij.openapi.components.impl.PlatformComponentManagerImpl.handleInitComponentError(PlatformComponentManagerImpl.java:43)
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:536)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:119)
    at com.intellij.openapi.application.impl.ApplicationImpl.lambda$createComponents$8(ApplicationImpl.java:429)
    at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
    at com.intellij.openapi.application.impl.ApplicationImpl.createComponents(ApplicationImpl.java:436)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:103)
    at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:392)
    at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:384)
    at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:196)
    ... 16 more
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 9 column 2 path $
    at com.google.gson.Gson.assertFullConsumption(Gson.java:837)
    at com.google.gson.Gson.fromJson(Gson.java:827)
    at com.android.sdklib.repository.targets.PlatformTarget.getLibsFromJson(PlatformTarget.java:179)
    at com.android.sdklib.repository.targets.PlatformTarget.<init>(PlatformTarget.java:124)
    at com.android.sdklib.repository.targets.AndroidTargetManager.getTargetMap(AndroidTargetManager.java:94)
    at com.android.sdklib.repository.targets.AndroidTargetManager.getTargets(AndroidTargetManager.java:80)
    at com.android.sdklib.repository.targets.AndroidTargetManager.getTargetFromHashString(AndroidTargetManager.java:154)
    at org.jetbrains.android.sdk.AndroidSdkData.findTargetByHashString(AndroidSdkData.java:216)
    at org.jetbrains.android.sdk.AndroidSdkAdditionalData.getBuildTarget(AndroidSdkAdditionalData.java:126)
    at org.jetbrains.android.sdk.AndroidPlatform.parse(AndroidPlatform.java:90)
    at org.jetbrains.android.sdk.AndroidSdkAdditionalData.getAndroidPlatform(AndroidSdkAdditionalData.java:137)
    at org.jetbrains.android.sdk.AndroidPlatform.getInstance(AndroidPlatform.java:68)
    at com.android.tools.idea.startup.GradleSpecificInitializer.checkAndSetSources(GradleSpecificInitializer.java:459)
    at com.android.tools.idea.startup.GradleSpecificInitializer.checkAndSetAndroidSdkSources(GradleSpecificInitializer.java:449)
    at com.android.tools.idea.startup.GradleSpecificInitializer.run(GradleSpecificInitializer.java:121)
    at com.android.tools.idea.AndroidInitialConfigurator.activateAndroidStudioInitializerExtensions(AndroidInitialConfigurator.java:198)
    at com.android.tools.idea.AndroidInitialConfigurator.<init>(AndroidInitialConfigurator.java:65)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
    at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:220)
    at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
    at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
    at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:58)
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:495)
    ... 28 more
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 9 column 2 path $
    at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1574)
    at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1423)
    at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:546)
    at com.google.gson.stream.JsonReader.peek(JsonReader.java:429)
    at com.google.gson.Gson.assertFullConsumption(Gson.java:833)
    ... 54 more

感谢您的帮助!

3 个答案:

答案 0 :(得分:3)

解决了问题。

我做了什么:

  • 关闭Android Studio
  • 转至/ users / your_name / library / preferences
  • 重命名文件夹&#39; AndroidStudio2.3&#39;到AndroidStudio2.3XXX&#39; (或其他:)))
  • 重启Android Studio
  • 由于我的Android SDK位于一个不寻常的文件夹中,Android Studio询问我是否要告诉我的SDK在哪里(选择此选项无法解决问题)或将其安装在默认的Android Studio位置;我选择了最后一个选项,它解决了这个问题!

答案 1 :(得分:0)

在Androids开源bug追踪器上发布了类似的问题:https://code.google.com/p/android/issues/detail?id=74458

解决方案是重新启动计算机。试试这个,看它是否有效。

答案 2 :(得分:0)

我也有那次崩溃。我猜这是由于上一个项目的上传。为了防止上传,我将其从androidstudioprojects文件夹(所有项目都存储在此文件夹中)中移了出来,并解决了问题-Studio初始化良好。但是之后,我将项目带回到那个文件夹,并从工作室打开了它,然后又崩溃了。由于我有另一个较新版本的android studio,因此我用它来打开该项目。在完成了整个过程(索引编制,构建等)之后,我关闭了该项目,然后再次尝试从Studio的第一个版本打开它,但此操作成功了。 我猜上次我与那个项目一起工作时,我关闭得不好(通过任务管理器),并且影响了某些事情。