我在我的布局视图中,我想截取它的截图 右键单击>保存屏幕截图,出现此错误:
http://oi58.tinypic.com/144cpwx.jpg
模拟器也是如此:
http://oi61.tinypic.com/sw5t8l.jpg
更新 这是文件的内容。
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<devices>
<device id="wear_square" name="Android Wear Square" url="TBD" physicalSize="1.65" physicalHeight="1.17" density="HDPI">
<orientation name="port" size="512,460" screenPos="122,88" screenSize="280,280" crop="22,50,474,403" shadow="shadow.png"
back="back.png" lights="fore.png" mask="mask.png"/>
<!-- how do we handle the other orientation? For now, duplicated -->
<orientation name="land" size="512,460" screenPos="122,88" screenSize="280,280" crop="22,50,474,403" shadow="shadow.png"
back="back.png" lights="fore.png" mask="mask.png"/>
</device>
<device id="wear_round" name="Android Wear Round" url="TBD" physicalSize="1.65" physicalHeight="1.65" density="HDPI">
<orientation name="port" size="512,460" screenPos="96,62" screenSize="320,320" crop="71,36,370,424" shadow="shadow.png"
back="back.png" lights="fore.png" mask="mask.png"/>
<!-- how do we handle the other orientation? For now, duplicated -->
<orientation name="land" size="512,460" screenPos="96,62" screenSize="320,320" crop="71,36,370,424" shadow="shadow.png"
back="back.png" lights="fore.png" mask="mask.png"/>
</device>
<device id="tv_1080p" name="Android TV 1080p" url="TBD" physicalSize="48" physicalHeight="27" density="XHDPI">
<orientation name="land" size="2090,1255" screenPos="85,59" screenSize="1920,1080" shadow="shadow.png"
back="back.png" lights="fore.png"/>
</device>
<device id="tv_720p" name="Android TV 720p" url="TBD" physicalSize="47.9" physicalHeight="27.0" density="TVDPI">
<orientation name="land" size="1394,837" screenPos="57,39" screenSize="1280,720" shadow="shadow.png"
back="back.png" lights="fore.png"/>
</device>
<device id="nexus_5" name="Nexus 5" url="http://www.google.com/nexus/5/" physicalSize="5" physicalHeight="5.43" density="XXHDPI">
<orientation name="port" size="1690,2857" screenPos="304,436" screenSize="1080,1920" crop="160,241,1370,2405" shadow="port_shadow.png"
back="port_back.png" lights="port_fore.png"/>
<orientation name="land" size="2857,1690" screenPos="436,306" screenSize="1920,1080" crop="175,241,2497,1235" shadow="land_shadow.png"
back="land_back.png" lights="land_fore.png"/>
</device>
<device id="nexus_4" name="Nexus 4" url="http://www.google.com/nexus/4/" physicalSize="4.7" physicalHeight="5.23" density="XHDPI">
<orientation name="port" size="1195,1994" screenPos="213,350" screenSize="768,1280" crop="119,163,958,1678" shadow="port_shadow.png"
back="port_back.png" lights="port_fore.png"/>
<orientation name="land" size="1994,1195" screenPos="349,214" screenSize="1280,768" crop="92,169,1799,885" shadow="land_shadow.png"
back="land_back.png" lights="land_fore.png"/>
</device>
<device id="nexus_7_2013" name="Nexus 7" url="http://www.google.com/nexus/7/" physicalSize="7.0" physicalHeight="8.0" density="XHDPI">
<orientation name="port" size="1289,1934" screenPos="244,326" screenSize="800,1280" crop="114,125,1064,1714" shadow="port_shadow.png"
back="port_back.png" lights="port_fore.png"/>
<orientation name="land" size="1934,1289" screenPos="326,245" screenSize="1280,800" crop="44,165,1848,986" shadow="land_shadow.png"
back="land_back.png" lights="land_fore.png"/>
</device>
<device id="nexus_7" name="Nexus 7 (2012)" url="http://www.google.com/nexus/7/" physicalSize="7.0" physicalHeight="7.81" density="213dpi">
<orientation name="port" size="1334,1902" screenPos="264,311" screenSize="800,1280" crop="122,121,1094,1689" shadow="port_shadow.png"
back="port_back.png" lights="port_fore.png"/>
<orientation name="land" size="1910,1334" screenPos="315,270" screenSize="1280,800" crop="55,165,1803,1045" shadow="land_shadow.png"
back="land_back.png" lights="land_fore.png"/>
</device>
<device id="nexus_10" name="Nexus 10" url="http://www.google.com/nexus/10/" physicalSize="10.0" physicalHeight="7.0" density="XHDPI">
<orientation name="port" size="1248,1730" screenPos="217,223" screenSize="800,1280" crop="34,90,1165,1568" shadow="port_shadow.png"
back="port_back.png" lights="port_fore.png"/>
<orientation name="land" size="1730,1248" screenPos="227,217" screenSize="1280,800" crop="33,84,1670,1088" shadow="land_shadow.png"
back="land_back.png" lights="land_fore.png"/>
</device>
<device id="xoom" name="Motorola XOOM" url="http://www.google.com/phone/detail/motorola-xoom" physicalSize="10.0" physicalHeight="6.61"
density="MDPI">
<orientation name="port" size="1198,1700" screenPos="199,200" screenSize="800,1280" crop="14,117,1170,1471" shadow="port_shadow.png"
back="port_back.png" lights="port_fore.png"/>
<orientation name="land" size="1700,1198" screenPos="218,191" screenSize="1280,800" crop="66,102,1569,998" shadow="land_shadow.png"
back="land_back.png" lights="land_fore.png"/>
</device>
<device id="galaxy_nexus" name="Galaxy Nexus" url="http://www.android.com/devices/detail/galaxy-nexus" physicalSize="4.65"
physicalHeight="5.33" density="XHDPI">
<orientation name="port" size="1148,1994" screenPos="216,353" screenSize="720,1280" crop="24,140,1101,1709" shadow="port_shadow.png"
back="port_back.png" lights="port_fore.png"/>
<orientation name="land" size="1994,1148" screenPos="371,199" screenSize="1280,720" crop="67,131,1847,886" shadow="land_shadow.png"
back="land_back.png" lights="land_fore.png"/>
</device>
<device id="nexus_s" name="Nexus S" url="http://www.google.com/phone/detail/nexus-s" physicalSize="4.0" physicalHeight="4.88"
density="HDPI">
<orientation name="port" size="749,1308" screenPos="134,247" screenSize="480,800" crop="15,87,719,1139" shadow="port_shadow.png"
back="port_back.png" lights="port_fore.png"/>
<orientation name="land" size="1308,749" screenPos="247,135" screenSize="800,480" crop="39,91,1210,586" shadow="land_shadow.png"
back="land_back.png" lights="land_fore.png"/>
</device>
<device id="nexus_one" name="Nexus One" url="http://en.wikipedia.org/wiki/Nexus_One" physicalSize="3.7" physicalHeight="4.7"
density="HDPI">
<orientation name="port" size="765,1300" screenPos="141,191" screenSize="480,800" crop="16,60,732,1178" shadow="port_shadow.png"
back="port_back.png"/>
<orientation name="land" size="1300,765" screenPos="200,130" screenSize="800,480" crop="0,78,1300,612" shadow="land_shadow.png"
back="land_back.png"/>
</device>
<device id="phone" name="Generic Phone">
<orientation name="port" size="568,256" screenPos="113,93" screenSize="343,46" back="phone_back_simple_port.9.png"
shadow="phone_shadow_simple_port.9.png" />
<orientation name="land" size="607,350" screenPos="141,36" screenSize="324,255" back="phone_back_simple_land.9.png"
shadow="phone_shadow_simple_land.9.png"/>
</device>
<device id="tablet" name="Generic Tablet">
<orientation name="port" size="1310,313" screenPos="256,111" screenSize="802,55" back="tablet_back_simple.9.png"
shadow="tablet_shadow_simple_port.9.png" />
<orientation name="land" size="1310,313" screenPos="256,111" screenSize="802,55" back="tablet_back_simple.9.png"
shadow="tablet_shadow_simple_land.9.png"/>
</device>
</devices>
答案 0 :(得分:1)
如果您的模拟器运行的是Android 4.4或者我认为4.3,那么屏幕截图功能就会被破坏 - 您必须使用物理设备来获取这些操作系统版本的屏幕截图。它适用于4.3之前的Android。
那个错误是: https://code.google.com/p/android/issues/detail?id=62284
答案 1 :(得分:0)
来自this thread:
已修复https://android-review.googlesource.com/#/c/100192/。 如果有人需要解决方法:在Android Studio发行版中编辑以下文件: 插件/机器人/ LIB /设备技术资源/设备art.xml
在第33行,插入插入&lt;! - 并在第43行插入 - &gt;
换句话说,注释掉两个电视设备定义。它们不提供纵向方向,这是导致屏幕截图代码崩溃的原因(当它搜索设备艺术以包围设备时)。
如果您这样做,请注意您在将来的更新中可能会遇到冲突,因此请将原始文件复制到某处并在更新到0.8.2之前将其恢复。