java Android Studio 错误:尝试计算所需的包时发生错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42733995/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android studio error: An error occurred while trying to compute required packages
提问by Gianluca Ghettini
I'm trying to install the latest Android Studio on a MacBook pro 2015
我正在尝试在 MacBook pro 2015 上安装最新的 Android Studio
Unfortunately I get this error:
不幸的是,我收到此错误:
An error occurred while trying to compute required packages.
尝试计算所需的包时出错。
Here a screenshot of the error:
这是错误的屏幕截图:
which is not very informative. What's causing the problem?
这不是很有用。导致问题的原因是什么?
EDIT
编辑
This is the exception I get when I run the application from the terminal:
这是我从终端运行应用程序时遇到的异常:
[ 33666] WARN - e.wizard.InstallComponentsPath - Dependant package with key emulator not found!
com.android.tools.idea.sdk.wizard.SdkQuickfixUtils$PackageResolutionException: Dependant package with key emulator not found!
at com.android.tools.idea.sdk.wizard.SdkQuickfixUtils.resolve(SdkQuickfixUtils.java:261)
at com.android.tools.idea.welcome.install.ComponentInstaller.getPackagesToInstall(ComponentInstaller.java:51)
at com.android.tools.idea.welcome.wizard.InstallComponentsPath.lambda$init./sdkmanager --channel=3 emulator
(InstallComponentsPath.java:195)
at com.android.tools.idea.welcome.wizard.InstallSummaryStep.generateSummary(InstallSummaryStep.java:115)
at com.android.tools.idea.welcome.wizard.InstallSummaryStep.onEnterStep(InstallSummaryStep.java:106)
at com.android.tools.idea.wizard.dynamic.DynamicWizardPath.next(DynamicWizardPath.java:311)
at com.android.tools.idea.wizard.dynamic.DynamicWizardPath.next(DynamicWizardPath.java:58)
at com.android.tools.idea.wizard.dynamic.DynamicWizard.showNextStep(DynamicWizard.java:346)
at com.android.tools.idea.wizard.dynamic.DynamicWizard.doNextAction(DynamicWizard.java:336)
at com.android.tools.idea.welcome.wizard.FirstRunWizardHost$NextAction.actionPerformed(FirstRunWizardHost.java:385)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access0(EventQueue.java:97)
at java.awt.EventQueue.run(EventQueue.java:709)
at java.awt.EventQueue.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue.run(EventQueue.java:731)
at java.awt.EventQueue.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:795)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:627)
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)
EDIT
编辑
Google has fixed the bug. Just download the new installer and everything should be fine
谷歌已经修复了这个错误。只需下载新的安装程序,一切都会好起来的
采纳答案by Charlie_Mtz
Update:
更新:
There's a manual workaround!
有一个手动解决方法!
As per post https://stackoverflow.com/a/42733510/7694425:
根据帖子https://stackoverflow.com/a/42733510/7694425:
- Download the command line tools, place them in the SDK folder (e.g., on mac: /Users/user/Library/Android/sdk), and then add the bin folder to the PATH.
- Install the latest platform: in a terminal, execute sdkmanager "platforms;android-25"
- Open Android Studio, and go to the SDK Manager (Appearance and Behavior > System Settings > Android SDK)
- Click on "Edit", and then select the sdk folder. Then "Next" > "Next" > "Finish".
- 下载命令行工具,将它们放在 SDK 文件夹中(例如,在 mac 上:/Users/user/Library/Android/sdk),然后将 bin 文件夹添加到 PATH。
- 安装最新平台:在终端中,执行 sdkmanager "platforms;android-25"
- 打开Android Studio,进入SDK Manager(Appearance and Behavior > System Settings > Android SDK)
- 单击“编辑”,然后选择 sdk 文件夹。然后“下一步”>“下一步”>“完成”。
Still, it doesn't resolve the missing emulator package therefore the Android SDK tools can't be updated since it's a dependency. But Android studio works and you can download other packages.
尽管如此,它并没有解决丢失的模拟器包,因此无法更新 Android SDK 工具,因为它是一个依赖项。但是 Android Studio 可以工作,您可以下载其他软件包。
Looking forward to a better solution.
期待更好的解决方案。
Update 2:
更新 2:
Solution to emulator package issue!
模拟器包问题解决!
After digging in the repo's XML for a while I've spotted the issue.
在研究了 repo 的 XML 一段时间后,我发现了这个问题。
It turns out that the "emulator" package is only in channel 3 (canary) while the "tools" package is in channel 0 (stable) but depends on "emulator". The solution is to force the manager to download the "emulator" package from channel 3:
事实证明,“模拟器”包仅在通道 3(金丝雀)中,而“工具”包在通道 0(稳定)中,但取决于“模拟器”。解决办法是强制管理器从通道3下载“模拟器”包:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
Problem solved!
问题解决了!
Previous answer:
上一个答案:
The same problem here.
同样的问题在这里。
Twitted @androidstudio too. Hopefully someone in a position to fix this will notice.
也发了@androidstudio。希望有能力解决这个问题的人会注意到。
回答by Tor Norbye
Updated: It should be fixed now.
更新:现在应该修复了。
This is https://code.google.com/p/android/issues/detail?id=244956-- we're working on a hotfix.
这是https://code.google.com/p/android/issues/detail?id=244956——我们正在开发修补程序。
回答by RpR
回答by Amit
I downloaded the setup again, it's working now, I am able to install it.
我再次下载了安装程序,它现在可以工作了,我可以安装它。
回答by Gianluca Ghettini
After lot of struggling I made it work. Here my solution
经过很多努力,我使它工作。这是我的解决方案
When I get the "An error occurred while trying to compute required packages" error I just clicked "finished" and then I went to the main Android Studio page:
当我收到“尝试计算所需的包时发生错误”错误时,我只是单击了“完成”,然后转到了主 Android Studio 页面:
Then I selected Configure -> SDK manager and I launched the SDK installation from there
然后我选择了配置 -> SDK 管理器,然后我从那里启动了 SDK 安装
Reopened Android Studio and everything was ok
重新打开 Android Studio 一切正常
Really, really embarrassing for a software which used to be very good. You can feel the "bloatness" of Eclipse creeping in
真的,对于一个曾经非常好的软件来说真的很尴尬。你可以感受到 Eclipse 的“臃肿”蔓延
回答by Vladimir Panteleev
I was getting this error on Arch Linux because the SDK setup wizard ran out of space on /tmp
, which is a tmpfs
.
我得到这个错误在Arch Linux的,因为SDK安装向导运行的空间了/tmp
,这是一个tmpfs
。
Another question with a similar error and same possible cause: Android studio- “SDK tools directory is missing”
另一个具有类似错误和相同可能原因的问题:Android studio-“SDK 工具目录丢失”