Android studio 2.3 always hangs out

天大地大妈咪最大 提交于 2019-12-24 07:54:21

问题


I'm using Android Studio 2.3 within gradle 2.3.3. I face a weird problem and being stuck for a week. It hangs out very often when I type some lines of code, right before it shows the auto complete box. Or if I didn't type anything but use Command-clickto find implementation of a variable or method, it show the dialog says Resolving Reference and hangs there. Sometime, if I switch to another application for awhile and switch back to view Android Studio, it hangs as well.

I already tried many different methods but didn't help, including:

  • Remove Android studio completely follow this answer then download and install again.
  • Go to menu File > Invalidate Cache/Restart...
  • Remove JDK and install again. I'm using JDK jdk-8u131-macosx-x64 downloaded from here
  • Delete all build folders and Rebuild Project
  • Rollback to my project's stable source code that I built successfully in the past.
  • Try to use Android Studio 3.0 Preview
  • Downgrade or upgrade Gradle Plugin
  • Download and replace the JDK bundle with Android studio follow this thread

All above methods didn't help to keep my Android Studio stability.

I am using Macbook with 16Gb of RAM, core i7, MacOS Sierra 10.12.5 and I don't think the hang is regarding to my laptop specification,

So I report my situation here and hope someone can help to give me new recommendation. Any idea or suggestion are appreciated.

Update: I check the logs of Android Studio under ~/Library/Logs/Android Studio2.3/ and see some exception log files. Below is the latest one:

2017-07-04 19:14:35,633 [1233357]   INFO - roid.sdk.MessageBuildingSdkLog - Exception from KotlinOutputParser 
2017-07-04 19:14:35,633 [1233357]   INFO - roid.sdk.MessageBuildingSdkLog - com.android.ide.common.blame.Message.<init>(com.android.ide.common.blame.Message$Kind, java.lang.String, java.lang.String, com.google.common.collect.ImmutableList) 
java.lang.NoSuchMethodException: com.android.ide.common.blame.Message.<init>(com.android.ide.common.blame.Message$Kind, java.lang.String, java.lang.String, com.google.common.collect.ImmutableList)
    at java.lang.Class.getConstructor0(Class.java:3082)
    at java.lang.Class.getConstructor(Class.java:1825)
    at org.jetbrains.kotlin.android.KotlinOutputParserHelper$simpleMessageConstructor$2.invoke(KotlinOutputParserHelper.kt:171)
    at org.jetbrains.kotlin.android.KotlinOutputParserHelper$simpleMessageConstructor$2.invoke(KotlinOutputParserHelper.kt:143)
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
    at org.jetbrains.kotlin.android.KotlinOutputParserHelper.getSimpleMessageConstructor(KotlinOutputParserHelper.kt)
    at org.jetbrains.kotlin.android.KotlinOutputParserHelper.createNewMessage(KotlinOutputParserHelper.kt:272)
    at org.jetbrains.kotlin.android.KotlinOutputParserHelper.createMessage(KotlinOutputParserHelper.kt:250)
    at org.jetbrains.kotlin.android.KotlinOutputParserHelper.createMessage$default(KotlinOutputParserHelper.kt:244)
    at org.jetbrains.kotlin.android.KotlinOutputParserHelperKt.parse(KotlinOutputParserHelper.kt:41)
    at org.jetbrains.kotlin.android.KotlinOutputParser.parse(KotlinOutputParser.java:28)
    at com.android.ide.common.blame.parser.ToolOutputParser.parseToolOutput(ToolOutputParser.java:86)
    at com.android.tools.idea.gradle.output.parser.BuildOutputParser.parseGradleOutput(BuildOutputParser.java:43)
    at com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutor$GradleTasksExecutorImpl.lambda$collectMessages$5(GradleTasksExecutor.java:516)
    at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
    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)

Update 2 Sometime Android Studio show a dialog for error report, with this message inside:

Cannot add jps/kotlin-jps-plugin.jar from plugin 'Kotlin' to external compiler classpath: home directory of plugin not found

回答1:


Finally I can build and continue coding without crash ( at least after 1 hour I don't get crash). For the Android Studio 2.3, I select File > Power Save Mode so it won't hang out any more. The worse thing is I can't use intelligent auto complete or auto-build at background.

Then, I install again Android studio 3.0 Preview Canary 5, using Gradle tool 3.0.0 alpha5. Fix all compile warnings (such as replace deprecated gradle functions by new ones), update all libraries to latest version,... It works!

Now I got 2 versions of Android Studio running concurrently. The old one running with Power Save Mode, the new one running with normal mode.



来源:https://stackoverflow.com/questions/44899335/android-studio-2-3-always-hangs-out

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!