解决Android Studio com.google.common.collect.ImmutableMap.hashCode 造成的StackOverflowError异常

Posted microhex

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决Android Studio com.google.common.collect.ImmutableMap.hashCode 造成的StackOverflowError异常相关的知识,希望对你有一定的参考价值。

最近在编译的过程中,android Studio 使用的是 Android Studio Chipmunk | Canary 5 版本,由于没有升级到最新版本,在编译的过程中出现了以下异常:

* Exception is:
java.lang.StackOverflowError
	at com.google.common.collect.ImmutableMap.hashCode(ImmutableMap.java:873)
	at com.android.build.gradle.internal.ide.dependencies.ResolvedArtifact.hashCode(ResolvedArtifact.kt)
	at com.android.build.gradle.internal.ide.dependencies.LibraryServiceImpl.getLibrary(LibraryService.kt:117)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:175)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at com.android.build.gradle.internal.ide.dependencies.FullDependencyGraphBuilder.handleDependency(FullDependencyGraphBuilder.kt:182)
	at c

截图是这种情况:



然后翻了一下google的bug记录,已经很明确的告之了这是一个bug,地址为:从这里去

下面说一下解决方案:

  1. 打开Android studio的 Help选项,找到 Edit Custom VM Options选项:


2. 打开配置文本之后,输入这么一段话:

-Dgradle.ide.gradle.sync.use.v2=false

输入完成之后:

  1. 先关掉Android Studio,然后重启即可。

希望可以帮助到你。

以上是关于解决Android Studio com.google.common.collect.ImmutableMap.hashCode 造成的StackOverflowError异常的主要内容,如果未能解决你的问题,请参考以下文章

Android studio的preview界面一直在加载,该如何解决?

Android studio出现这种情况怎么解决?

Android studio出现这样的问题,怎么解决?求助

关于android studio so文件 冲突 怎么解决

android studio 新建项目后总卡在Download gradle-3.1.2.pom 如何解决

Android studio里的passWord打字变成圆点怎么解决?