[Android] AndroidStudio cannot create a native emulator

An extremely extreme anomaly!


java.lang.IllegalStateException: @NotNull method com/android/tools/idea/avdmanager/AvdOptionsModel.getCreatedAvd must not return null
    at com.android.tools.idea.avdmanager.AvdOptionsModel.$$$reportNull$$$0(AvdOptionsModel.java)
    at com.android.tools.idea.avdmanager.AvdOptionsModel.getCreatedAvd(AvdOptionsModel.java:811)
    at com.android.tools.idea.avdmanager.CreateAvdAction.actionPerformed(CreateAvdAction.java:44)
    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:6550)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
    at java.awt.Component.processEvent(Component.java:6315)
    at java.awt.Container.processEvent(Container.java:2239)
    at java.awt.Component.dispatchEventImpl(Component.java:4899)
    at java.awt.Container.dispatchEventImpl(Container.java:2297)
    at java.awt.Component.dispatchEvent(Component.java:4721)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
    at java.awt.Container.dispatchEventImpl(Container.java:2283)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4721)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
    at java.awt.EventQueue$4.run(EventQueue.java:739)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:729)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:674)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:373)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    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)


background


    About half a year ago, I found that my C drive was running out of memory, and later found that in the C:\Users\acer\.android directory, a simple avd directory took up 10G, which is the default installation directory of AndroidStudio.


    In order to move it out of the C drive, I found the following article in the blog garden. The article introduces a technique, which is simply a strange trick . I did it and successfully moved avd to it. I am relatively wealthy. D drive. You can also learn how to move the Android Studio native emulator out of the C drive.
    Article address:
    [Solve the problem of AndroidStudio Android emulator being installed on D drive](https://www.cnblogs.com/LiuDanK/articles/10106473.html)
    
    

origin


    Two days ago, my D drive space was not enough. I thought about it, just delete the avd directory, and then use the night god or Genymotion emulator.
    

go through


    One does not do, two endlessly, decisively delete the avd directory under the D drive, all of a sudden free up 10G of space.
    
 

result


    Everyone knows that only native emulators can use 10.0.0.2 to replace the local IP. Otherwise, like my laptop, the IP is not fixed and needs to be changed frequently. I thought about bringing the native simulator back, but I encountered the error at the beginning of the article.
    



    StackOverflow gang didn't solve the problem either.
    I thought about it for a long time, and I remembered that wave of kinky tricks half a year ago, so a series of past events rushed out.
    
    Find the avd in the C:\Users\acer\.android directory, right-click the properties, and check that the mapped path is D:\Users\acer\.android\avd,
    so I manually put D:\Users\acer\.android\ The avd path is established, and then the native simulator is successfully created


​    
    

Summarize


    My situation is quite special. In general, the path configured by AndroidStudio does not exist. However, the cute AndroidStudio is stupid and will not create it manually. It will report an error and refuse to create it!


    
    Google's own son, we don't dare to say, we don't dare to ask...

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326167460&siteId=291194637