简体   繁体   中英

Unable to create Android Virtual Device in Android Studio 2.2 in Ubuntu

At the end of the setup of adding virtual device(after selecting the Device & android version,) when I click on finish. I see the following error in the console: 5:56:14 AM NoSuchFileException: /home/amit_gaur/.android/avd/Nexus_6P_API_23.ini

note that the problem is not due to the spaces in the name of the device, I have tried it, still did not work.

NOTE: I am using Android studio in Ubuntu 16.04 LTS with KVM installed on a Dell laptop with 4xIntel Core i3-5005U CPU @2.00Ghz.

Following lines get displayed on the terminal:

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0
Looking in classpath from com.intellij.util.lang.UrlClassLoader@2077d4de for /com/sun/jna/linux-x86-64/libjnidispatch.so
Found library resource at jar:file:/usr/local/android-studio/lib/jna.jar!/com/sun/jna/linux-x86-64/libjnidispatch.so
Trying /home/amit_gaur/.AndroidStudio2.2/system/tmp/jna9084144031884229775.tmp
Found jnidispatch at /home/amit_gaur/.AndroidStudio2.2/system/tmp/jna9084144031884229775.tmp
[   8671]   WARN - dea.updater.SdkComponentSource - File /home/amit_gaur/.android/repositories.cfg could not be loaded. 
[  12752]   WARN - dea.updater.SdkComponentSource - java.io.FileNotFoundException: /tmp/StudioDownloaderaddon2-1.xml (No such file or directory) 
[  17167]   WARN - roid.tools.ndk.GradleWorkspace - NDK support for project 'MyApplication' is disabled because the project doesn't contain any valid native configurations. 
[  40084]  ERROR - vdmanager.AvdManagerConnection - /home/amit_gaur/.android/avd/Nexus_6P_API_23.ini 
java.nio.file.NoSuchFileException: /home/amit_gaur/.android/avd/Nexus_6P_API_23.ini
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
    at java.nio.file.Files.newOutputStream(Files.java:216)
    at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:247)
    at com.android.repository.io.impl.FileSystemFileOp.newFileOutputStream(FileSystemFileOp.java:235)
    at com.android.sdklib.internal.avd.AvdManager.writeIniFile(AvdManager.java:1673)
    at com.android.sdklib.internal.avd.AvdManager.createAvdIniFile(AvdManager.java:1248)
    at com.android.sdklib.internal.avd.AvdManager.createAvd(AvdManager.java:823)
    at com.android.tools.idea.avdmanager.AvdManagerConnection.createOrUpdateAvd(AvdManagerConnection.java:582)
    at com.android.tools.idea.avdmanager.AvdOptionsModel.handleFinished(AvdOptionsModel.java:680)
    at com.android.tools.idea.wizard.model.ModelWizard.handleFinished(ModelWizard.java:350)
    at com.android.tools.idea.wizard.model.ModelWizard.goForward(ModelWizard.java:275)
    at com.android.tools.idea.wizard.model.ModelWizardDialog$FinishAction.doAction(ModelWizardDialog.java:309)
    at com.intellij.openapi.ui.DialogWrapper$DialogWrapperAction.actionPerformed(DialogWrapper.java:1811)
    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.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:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:857)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
    at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
    at java.awt.Dialog.show(Dialog.java:1084)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:792)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:465)
    at com.intellij.openapi.ui.DialogWrapper.invokeShow(DialogWrapper.java:1661)
    at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1610)
    at com.android.tools.idea.wizard.model.ModelWizardDialog.show(ModelWizardDialog.java:127)
    at com.intellij.openapi.ui.DialogWrapper.showAndGet(DialogWrapper.java:1625)
    at com.android.tools.idea.avdmanager.CreateAvdAction.actionPerformed(CreateAvdAction.java:42)
    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.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:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:857)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
    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)
[  40086]  ERROR - vdmanager.AvdManagerConnection - Android Studio 2.2.3  Build #AI-145.3537739 
[  40087]  ERROR - vdmanager.AvdManagerConnection - JDK: 1.8.0_76-release 
[  40087]  ERROR - vdmanager.AvdManagerConnection - VM: OpenJDK 64-Bit Server VM 
[  40087]  ERROR - vdmanager.AvdManagerConnection - Vendor: JetBrains s.r.o 
[  40087]  ERROR - vdmanager.AvdManagerConnection - OS: Linux 
[  40087]  ERROR - vdmanager.AvdManagerConnection - Last Action: Android.RunAndroidAvdManager
    *

I found the same problem on my system, and the reason was that Android Studio created the ~/.android folder owned by root. To fix it I just did this: sudo chown mnew .android

After that, I was able able to create the emulator because Studio was able to create and use the .android/avd directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM