在我将Android Studio从2.1.2更新到2.3之后,会发生这种情况。我的系统设置如下:
Android Studio 2.3 Build #AI-162.3764568
JDK: 1.8.0_112-release
VM: OpenJDK 64-Bit Server VM
OS: Ubuntu 16.10 64 bits
更新SDK后,android studio冻结的UI和以下是记录的错误:
[ 41743] ERROR - intellij.openapi.progress.Task - java.lang.NoSuchFieldError: FN_AAPT2
java.lang.RuntimeException: java.lang.NoSuchFieldError: FN_AAPT2
at com.intellij.openapi.application.impl.LaterInvocator.invokeAndWait(LaterInvocator.java:177)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:634)
at com.android.tools.idea.ui.ApplicationUtils.invokeWriteActionAndWait(ApplicationUtils.java:39)
at com.android.tools.idea.welcome.wizard.InstallComponentsPath$SetPreference.apply(InstallComponentsPath.java:373)
at com.android.tools.idea.welcome.wizard.InstallComponentsPath$SetPreference.apply(InstallComponentsPath.java:362)
at com.android.tools.idea.welcome.install.InstallOperation$FunctionWrapper.perform(InstallOperation.java:177)
at com.android.tools.idea.welcome.install.InstallOperation.execute(InstallOperation.java:68)
at com.android.tools.idea.welcome.install.InstallOperation$OperationChain.perform(InstallOperation.java:151)
at com.android.tools.idea.welcome.install.InstallOperation.execute(InstallOperation.java:68)
at com.android.tools.idea.welcome.install.InstallOperation$OperationChain.perform(InstallOperation.java:149)
at com.android.tools.idea.welcome.install.InstallOperation.execute(InstallOperation.java:68)
at com.android.tools.idea.welcome.install.InstallOperation$OperationChain.perform(InstallOperation.java:149)
at com.android.tools.idea.welcome.install.InstallOperation.execute(InstallOperation.java:68)
at com.android.tools.idea.welcome.wizard.InstallComponentsPath.runLongOperation(InstallComponentsPath.java:251)
at com.android.tools.idea.welcome.wizard.ConsolidatedProgressStep.doLongRunningOperation(ConsolidatedProgressStep.java:78)
at com.android.tools.idea.welcome.wizard.ConsolidatedProgressStep.access$000(ConsolidatedProgressStep.java:32)
at com.android.tools.idea.welcome.wizard.ConsolidatedProgressStep$1.run(ConsolidatedProgressStep.java:58)
at com.android.tools.idea.welcome.wizard.FirstRunWizardHost$LongRunningOperationWrapper.run(FirstRunWizardHost.java:430)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:635)
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.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:128)
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)
Caused by: java.lang.NoSuchFieldError: FN_AAPT2
at com.android.sdklib.BuildToolInfo.<init>(BuildToolInfo.java:352)
at com.android.sdklib.BuildToolInfo.fromStandardDirectoryLayout(BuildToolInfo.java:224)
at com.android.sdklib.BuildToolInfo.fromLocalPackage(BuildToolInfo.java:238)
at com.android.sdklib.repository.AndroidSdkHandler.getLatestBuildTool(AndroidSdkHandler.java:772)
at com.android.sdklib.repository.targets.PlatformTarget.<init>(PlatformTarget.java:144)
at com.android.sdklib.repository.targets.AndroidTargetManager.getTargetMap(AndroidTargetManager.java:94)
at com.android.sdklib.repository.targets.AndroidTargetManager.getTargets(AndroidTargetManager.java:80)
at org.jetbrains.android.sdk.AndroidSdkData.getTargetCollection(AndroidSdkData.java:171)
at org.jetbrains.android.sdk.AndroidSdkData.getTargets(AndroidSdkData.java:176)
at com.android.tools.idea.sdk.IdeSdks.createAndroidSdkPerAndroidTarget(IdeSdks.java:348)
at com.android.tools.idea.sdk.IdeSdks.setAndroidSdkPath(IdeSdks.java:294)
at com.android.tools.idea.sdk.IdeSdks.setAndroidSdkPath(IdeSdks.java:224)
at com.android.tools.idea.welcome.wizard.InstallComponentsPath$SetPreference.lambda$apply$0(InstallComponentsPath.java:374)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:898)
at com.android.tools.idea.ui.ApplicationUtils$1.run(ApplicationUtils.java:35)
at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:156)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:326)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:310)
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.defaultDispatchEvent(IdeEventQueue.java:795)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:631)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:387)
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)
[ 41747] ERROR - intellij.openapi.progress.Task - Android Studio 2.3 Build #AI-162.3764568
[ 41747] ERROR - intellij.openapi.progress.Task - JDK: 1.8.0_112-release
[ 41748] ERROR - intellij.openapi.progress.Task - VM: OpenJDK 64-Bit Server VM
[ 41748] ERROR - intellij.openapi.progress.Task - Vendor: JetBrains s.r.o
[ 41748] ERROR - intellij.openapi.progress.Task - OS: Linux
[ 41748] ERROR - intellij.openapi.progress.Task - Last Action:
有人可以提出解决此问题的建议吗?
答案 0 :(得分:1)
删除以前版本的Android Studio(如果有)。然后在/usr/local
复制最新版本,然后更改目录cd android-studio/bin/
,最后使用./studio.sh
启动Android Studio。
答案 1 :(得分:0)
也许这会帮助在升级AndroidStudio版本时遇到同样问题的人。