Cannot run UIAutomator tests in latest version of Android SDK -


i've upgraded latest version of android studio (1.5) , sdk , uiautomator tests, run ant, don't work anymore (they used to, till android studio 1.0.x).

this script use run tests:

@echo off  cls  set android_home=c:\users\xxxx\appdata\local\android\sdk set java_home=c:\program files\java\jdk1.8.0_65  cmd /c ..\..\..\..\..\..\..\..\thirdparty\ant\bin\ant build  if errorlevel 1 goto end  :run  cmd /c adb push ..\..\..\..\..\..\..\app\libs\uiautomator.jar /data/local/tmp cmd /c adb push .\bin\mytestsuiautomatortest.jar /data/local/tmp  cmd /c adb shell uiautomator runtest mytestsuiautomatortest.jar -c xxxxxx.haylugar.uiautomator.src.settingsactivityuiautomatortest cmd /c adb shell uiautomator runtest haylugaruiautomatortest.jar -c xxxxxx.haylugar.uiautomator.src.parkinglistactivityuiautomatortest cmd /c adb shell uiautomator runtest haylugaruiautomatortest.jar -c xxxxx.haylugar.uiautomator.src.parkingdetailactivityuiautomatortest 

when building ant, uiautomator.jar objects not found:

src\parkingdetailactivityuiautomatortest.java:3: error: package com.android.uiautomator.core not exist     [javac] import com.android.uiautomator.core.uiobject; 

apparently, instructions have been changed according this , this, followed them , missing (i error when running tests saying "no tests found run"). anyway, want run tests same way used to! don't want change configurations , waste time new nitty britty idea of android sdk team...

fixed!

i needed edit manually build.xml overwrite compile , dex targets of uibuild.xml provided sdk job correctly, copying required libraries (uiautomator.jar , junit.jar) somewhere in project structure:

    <property name="jar.libs.dir" value="../../../../../../libs" /> <property name="jar.libs.absolute.dir" location="${jar.libs.dir}" /> <path id="classpath">     <fileset dir="${jar.libs.absolute.dir}">         <include name="uiautomator.jar" />         <include name="junit-4.12.jar" />     </fileset> </path> <!-- version-tag: version_tag --> <import file="${sdk.dir}/tools/ant/uibuild.xml" />   <!-- overwrite compile target in uibuild.xml include external      jars --> <target name="compile" depends="-build-setup, -pre-compile">     <javac encoding="${java.encoding}" source="${java.source}"         target="${java.target}" debug="true" extdirs="" includeantruntime="false"         destdir="${out.classes.absolute.dir}" bootclasspathref="project.target.class.path"         verbose="${verbose}" fork="${need.javac.fork}">         <src path="${source.absolute.dir}" />         <classpath refid="classpath" />         <compilerarg line="${java.compilerargs}" />     </javac> </target>  <!-- overwrite -dex target in uibuild.xml include external jar files      target dex file. --> <target name="-dex" depends="compile, -post-compile">     <dex executable="${dx}" output="${intermediate.dex.file}"         nolocals="@{nolocals}" verbose="${verbose}">         <path path="${out.classes.absolute.dir}" />     </dex> </target>  </project> 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -