由于锁定屏幕,找不到ID为'''的Android视图!

时间:2015-02-24 11:49:23

标签: java android android-emulator

我有两个函数可以启动三个带有10,18,21个sdk版本的android模拟器,而不是发送命令来解锁屏幕。

function emulator {
os=$1
density=$2
abi=$3
port=$4

EMULATOR_NAME="hudson_en_US_${density}_${os}_armeabi-v7a"


echo no | /opt/android-sdk/tools/android create avd -f -a -c 100M -n ${EMULATOR_NAME} -t ${os} --abi ${abi}

/opt/android-sdk/platform-tools/adb start-server

/opt/android-sdk/tools/emulator -no-boot-anim -ports ${port},$(($port + 1)) -avd ${EMULATOR_NAME}  -no-snapshot-load -no-snapshot-save -wipe-data &

stat=""
while [[ "$stat" -ne "1" ]]
  do
  sleep 20
  #/opt/android-sdk/platform-tools/adb connect emulator-${port}
  stat=$(/opt/android-sdk/platform-tools/adb -s emulator-${port} shell getprop dev.bootcomplete | sed -e "s/\r//")
done

if [ "$?" != '0' ]; then
        echo "Error in run android emulator"
        exit 1;
fi             

/opt/android-sdk/platform-tools/adb -s emulator-${port} logcat > ${EMULATOR_NAME}.log &

/opt/android-sdk/platform-tools/adb -s emulator-${port} shell input keyevent 82
  }

function unlock {

port=$1
/opt/android-sdk/platform-tools/adb -s emulator-${port} shell input keyevent 82

  }

  /opt/android-sdk/platform-tools/adb kill-server

  emulator android-21 480 armeabi-v7a 5517
  emulator android-10 160 armeabi 5515
  emulator android-18 320 armeabi-v7a 5569
   sleep 190
   unlock 5517
   unlock 5515
   unlock 5569

但是我的开发人员告诉我他们的connectedAndroidTests测试因为我的锁定仿真器而失败。下面的一段失败:

com.tres.one.android.functional.usertype.DifferentAccountDrawerTest >    testEnthusiastShouldSeeSpecificItems[hudson_en_US_160_android-10_armeabi-v7a(AVD) - 2.3.3] [31mFAILED [0m
junit.framework.AssertionFailedError: View with id: '2131427462' is not found!
at com.robotium.solo.Solo.getView(Solo.java:2026)

热门解决这个问题?因为当地一切都很好

0 个答案:

没有答案