3

When i take a screenshot of my app (Material Design with Elevations), the shadow (elevation) is not in the saved screenshot-file. I try it with a real Device (Nexus 5) and with the google emulator. The screenshots looks fine but the shadows are not included.

i captured the screenshots with solo AND screencap (adb shell).

anybody a idea? thank you

EDIT: Manifest (Part):

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="my.package.name"
    android:installLocation="auto"
    android:versionCode="123"
    android:versionName="1.23" >

    <supports-screens android:anyDensity="true"
                      android:largeScreens="true"
                      android:normalScreens="true"
                      android:resizeable="true"
                      android:smallScreens="true"
                      android:xlargeScreens="true"/>

    <uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

    <uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="21" />

    <uses-permission android:name="android.permission.INTERNET" />
    <!-- ... -->

    <application
    android:name="MyApplication"
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:vmSafeMode="true"
    android:theme="@style/AppTheme">
    <!-- definition of receivers -->
    <!-- definition of activities -->
    </application>

</manifest>
silly
  • 7,789
  • 2
  • 24
  • 37
  • 3
    I am having no problems capturing screenshots with shadows from system apps on a Nexus 4 (Calculator, Contacts, Play Store) -- I just tested it with the Android Device Monitor. Do you have a reproducible test case for this? – CommonsWare Dec 19 '14 at 01:15
  • I second @CommonsWare, no problems with screenshots on Nexus 5; shadows are included. – ozbek Dec 21 '14 at 22:41
  • ok, it works with a nexus 5 and the android device monitor, but not with a avd device (host gpu enabled). – silly Dec 22 '14 at 11:04
  • can you just show me manifest min and max sdk version? – Digvesh Patel Dec 23 '14 at 06:07
  • @silly: you should update your question by mentioning that it works in nexus5 and avd but doesn't work with host gpu avd. – Mehul Joisar Dec 24 '14 at 14:14

2 Answers2

1

change in manifest file:

<uses-sdk
    android:minSdkVersion="21"
    android:targetSdkVersion="21" />

And now check your code plz.

Digvesh Patel
  • 6,503
  • 1
  • 20
  • 34
  • thank you for your answer, but the screenshots (taken with solo robotium) are the same (without shadows) – silly Dec 23 '14 at 09:40
0

Robotium can take screenshots which include only parts of tested application. It means that for instance status bar is excluded. As far as I know screencap can handle that, but I'm not sure. You can also try another ways of taking screenshots:

  1. using DDMS
  2. using UIAutomator
  3. using Android Screenshot Library
Community
  • 1
  • 1
maszter
  • 3,680
  • 6
  • 37
  • 53
  • thank you for your answer, the elevation is a part of MY application. The Problem is, the elevation (Shadows) not included in the screenshot. – silly Dec 11 '14 at 10:16
  • 1
    Yes, they are part of your application but probably drawn in a different window that is not part of your application. And robotium and such tools, can't access those different windows. – nickmartens1980 Dec 23 '14 at 13:02