为啥在我创建新项目时会在 android studio 中出现此错误?

Posted

技术标签:

【中文标题】为啥在我创建新项目时会在 android studio 中出现此错误?【英文标题】:why this errors in android studio occurred when i create new project?为什么在我创建新项目时会在 android studio 中出现此错误? 【发布时间】:2016-12-10 06:31:10 【问题描述】:

IDE 致命错误:

插件 Android 支持 中的异常。 3 分钟前。自上次清除以来发生过一次。未读。禁用插件...

错误信息:

Parse exception while reading distributions.json: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $

Details:
Parse exception while reading distributions.json: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
    at com.google.gson.Gson.fromJson(Gson.java:822)
    at com.google.gson.Gson.fromJson(Gson.java:775)
    at com.google.gson.Gson.fromJson(Gson.java:724)
    at com.android.tools.idea.stats.DistributionService.loadDistributionsFromJson(DistributionService.java:319)
    at com.android.tools.idea.stats.DistributionService.loadFromFile(DistributionService.java:297)
    at com.android.tools.idea.stats.DistributionService.loadStatsSynchronously(DistributionService.java:222)
    at com.android.tools.idea.stats.DistributionService.access$000(DistributionService.java:54)
    at com.android.tools.idea.stats.DistributionService$2.run(DistributionService.java:194)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:126)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:366)
    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)
    at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
    at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:350)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:79)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
    at com.google.gson.Gson.fromJson(Gson.java:810)
    ... 21 more

【问题讨论】:

【参考方案1】:

试试这个:

    打开 Android Studio 终端类型 gradlew

    C:\ProjectDir> gradlew

    如果出错使用此命令:(使用代理)

    gradlew -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8580

    设置 JDK 位置最新版本:文件 -> 项目结构 -> SDK 位置 -> JDK 位置

【讨论】:

以上是关于为啥在我创建新项目时会在 android studio 中出现此错误?的主要内容,如果未能解决你的问题,请参考以下文章

为啥下一个 js 在我构建时会在第一次加载时加载所有页面

为啥 SQLite 替换功能会在我的 Android 应用程序中产生错误?

为啥以 const char* 返回时会在此处创建临时字符串? [Stroustrup 的书例]

为啥我的 UIView 在滚动时会在 UIScrollView 内移动?

为啥在终端上写 ppm 时会在终端上弹出 Perl 包管理器而不是 ppm>

为啥 GCC 会在我的机器上创建额外的汇编指令?