Reputation: 23
I am in my layout View, and I wan to take a screenshot of it by doing right-click>save screenshot, and this error appears:
http://oi58.tinypic.com/144cpwx.jpg
The same happens with the emulator:
http://oi61.tinypic.com/sw5t8l.jpg
Update: This is the content of the file.
<?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>
Upvotes: 0
Views: 1268
Reputation: 5447
From this thread:
Fixed in https://android-review.googlesource.com/#/c/100192/ . If anyone needs a workaround: edit the following file in your Android Studio distribution: plugins/android/lib/device-art-resources/device-art.xml
On line 33, insert insert <!-- and on line 43 insert -->
In other words, comment out the two tv device definitions. They don't supply a portrait orientation, which is what is causing the crash in the screenshot code (when it searches for device art to surround the device with).
If you do this, note that you may get conflicts in a future update, so please copy the original file somewhere and restore it before updating to 0.8.2.
Upvotes: 0
Reputation: 598
If your emulator is running Android 4.4 or I think 4.3, then screen capture functionality is broken -- you'll have to use a physical device to get screenshots on those OS versions. It works okay for Android prior to 4.3.
That bug is: https://code.google.com/p/android/issues/detail?id=62284
Upvotes: 1