5

我刚刚更新到 Intellij Community 的最新版本,但是当我尝试编辑 xml 文件时,我无法预览它,出现渲染错误 - 未指定设备,我怎样才能恢复默认配置?

4

4 回答 4

10

为了在 Intellij 中进行设备配置,您需要将device.xml文件 from修改USER_HOME/.android folderdevice.xmlfrom ,SDK_FOLDER/tools/lib/device.xml然后尝试在 Intellij 中再次重新打开布局文件文件,您将获得所有设备配置。

但是,如果您拥有最新版本的 Android SDK 工具,这将不起作用,

如果您拥有最新的 SDK,请尝试将 USER_HOME/.android/device.xml 替换为以下内容。并尝试再次在 Intellij 中重新打开布局文件。

<?xml version="1.0"?>
<d:layout-devices
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:d="http://schemas.android.com/sdk/android/layout-devices/1">

    <d:device name="2.7in QVGA">
        <d:default>
            <d:screen-size>small</d:screen-size>
            <d:screen-ratio>notlong</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>ldpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>240</d:size>
                <d:size>320</d:size>
            </d:screen-dimension>
            <d:xdpi>145</d:xdpi>
            <d:ydpi>145</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="2.7in QVGA slider">
        <d:default>
            <d:screen-size>small</d:screen-size>
            <d:screen-ratio>notlong</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>ldpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:text-input-method>qwerty</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>240</d:size>
                <d:size>320</d:size>
            </d:screen-dimension>
            <d:xdpi>145</d:xdpi>
            <d:ydpi>145</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape, closed">
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
        <d:config name="Landscape, open">
            <d:keyboard-state>keysexposed</d:keyboard-state>
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="3.2in HVGA slider (ADP1)">
        <d:default>
            <d:screen-size>normal</d:screen-size>
            <d:screen-ratio>notlong</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>mdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:text-input-method>qwerty</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>trackball</d:nav-method>
            <d:screen-dimension>
                <d:size>320</d:size>
                <d:size>480</d:size>
            </d:screen-dimension>
            <d:xdpi>180.6</d:xdpi>
            <d:ydpi>182</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape, closed">
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
        <d:config name="Landscape, open">
            <d:keyboard-state>keysexposed</d:keyboard-state>
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="3.2in HVGA (ADP2)">
        <d:default>
            <d:screen-size>normal</d:screen-size>
            <d:screen-ratio>notlong</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>mdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>trackball</d:nav-method>
            <d:screen-dimension>
                <d:size>320</d:size>
                <d:size>480</d:size>
            </d:screen-dimension>
            <d:xdpi>180.6</d:xdpi>
            <d:ydpi>182</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="3.3in WQVGA">
        <d:default>
            <d:screen-size>normal</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>ldpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>240</d:size>
                <d:size>400</d:size>
            </d:screen-dimension>
            <d:xdpi>141</d:xdpi>
            <d:ydpi>141</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>
    <d:device name="3.4in FWQVGA">
        <d:default>
            <d:screen-size>normal</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>ldpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>240</d:size>
                <d:size>432</d:size>
            </d:screen-dimension>
            <d:xdpi>145</d:xdpi>
            <d:ydpi>145</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="3.7in WVGA (Nexus One)">
        <d:default>
            <d:screen-size>normal</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>hdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>trackball</d:nav-method>
            <d:screen-dimension>
                <d:size>480</d:size>
                <d:size>800</d:size>
            </d:screen-dimension>
            <d:xdpi>254</d:xdpi>
            <d:ydpi>254</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="3.7in FWVGA slider">
        <d:default>
            <d:screen-size>normal</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>hdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:text-input-method>qwerty</d:text-input-method>
            <d:nav-state>navhidden</d:nav-state>
            <d:nav-method>dpad</d:nav-method>
            <d:screen-dimension>
                <d:size>480</d:size>
                <d:size>854</d:size>
            </d:screen-dimension>
            <d:xdpi>265</d:xdpi>
            <d:ydpi>265</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape, closed">
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
        <d:config name="Landscape, open">
            <d:keyboard-state>keysexposed</d:keyboard-state>
            <d:screen-orientation>land</d:screen-orientation>
            <d:nav-state>navexposed</d:nav-state>
        </d:config>
    </d:device>

    <d:device name="4in WVGA (Nexus S)">
        <d:default>
            <d:screen-size>normal</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>hdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>480</d:size>
                <d:size>800</d:size>
            </d:screen-dimension>
            <d:xdpi>235</d:xdpi>
            <d:ydpi>235</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="4.65in 720p (Galaxy Nexus)">
        <d:default>
            <d:screen-size>normal</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>xhdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>720</d:size>
                <d:size>1280</d:size>
            </d:screen-dimension>
            <d:xdpi>316</d:xdpi>
            <d:ydpi>316</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="4.7in WXGA">
        <d:default>
            <d:screen-size>normal</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>xhdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>1280</d:size>
                <d:size>720</d:size>
            </d:screen-dimension>
            <d:xdpi>320</d:xdpi>
            <d:ydpi>320</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="5.1in WVGA">
        <d:default>
            <d:screen-size>large</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>mdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>480</d:size>
                <d:size>800</d:size>
            </d:screen-dimension>
            <d:xdpi>183</d:xdpi>
            <d:ydpi>183</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="5.4in FWVGA">
        <d:default>
            <d:screen-size>large</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>port</d:screen-orientation>
            <d:pixel-density>mdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>480</d:size>
                <d:size>854</d:size>
            </d:screen-dimension>
            <d:xdpi>181</d:xdpi>
            <d:ydpi>181</d:ydpi>
        </d:default>

        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
    </d:device>

    <d:device name="7in WSVGA (Tablet)">
        <d:default>
            <d:screen-size>large</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>land</d:screen-orientation>
            <d:pixel-density>mdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>1024</d:size>
                <d:size>600</d:size>
            </d:screen-dimension>
            <d:xdpi>169</d:xdpi>
            <d:ydpi>169</d:ydpi>
        </d:default>

        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
    </d:device>


    <d:device name="10.1in WXGA (Tablet)">
        <d:default>
            <d:screen-size>xlarge</d:screen-size>
            <d:screen-ratio>long</d:screen-ratio>
            <d:screen-orientation>land</d:screen-orientation>
            <d:pixel-density>mdpi</d:pixel-density>
            <d:touch-type>finger</d:touch-type>
            <d:keyboard-state>keyssoft</d:keyboard-state>
            <d:text-input-method>nokeys</d:text-input-method>
            <d:nav-state>navexposed</d:nav-state>
            <d:nav-method>nonav</d:nav-method>
            <d:screen-dimension>
                <d:size>1280</d:size>
                <d:size>800</d:size>
            </d:screen-dimension>
            <d:xdpi>149</d:xdpi>
            <d:ydpi>149</d:ydpi>
        </d:default>

        <d:config name="Landscape">
            <d:screen-orientation>land</d:screen-orientation>
        </d:config>
        <d:config name="Portrait">
            <d:screen-orientation>port</d:screen-orientation>
        </d:config>
    </d:device>
</d:layout-devices>
于 2012-11-23T07:41:27.310 回答
0

处理上面的 xml 并将其粘贴到 device.xml 文件中对我有用,谢谢 Nixiti,这看起来很容易,但它有很大帮助

于 2013-04-08T14:06:17.313 回答
0

现在它更改为USER_HOME/.android中的devices.xml (NOT device.xml) 文件

更高版本的 Android SDK 工具有 SDK_FOLDER/tools/lib/ devices.xml

于 2013-08-21T05:52:06.597 回答
0

不严重。只需将预览窗格上的渲染版本切换到较低版本即可。

在此处输入图像描述

于 2014-07-27T07:31:46.683 回答