当我运行我的Android UIAutomator代码时,它显示以下错误.
INSTRUMENTATION_RESULT:shortMsg = java.lang.RuntimeException
INSTRUMENTATION_RESULT:longMsg = com.android.ui.testing
INSTRUMENTATION_CODE:0
我刚刚运行了developer.android.com中给出的示例代码
如何解决此错误?
日志附在下面:
01-05 01:07:53.559: D/AndroidRuntime(5712): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
01-05 01:07:53.559: D/AndroidRuntime(5712): CheckJNI is ON
01-05 01:07:53.559: E/AndroidRuntime(5712): cannot open customer xml file
01-05 01:07:53.559: E/AndroidRuntime(5712): /system/csc/customer.xml can't open file
01-05 01:07:53.564: D/AndroidRuntime(5712): readGMSProperty: start
01-05 01:07:53.564: D/AndroidRuntime(5712): readGMSProperty: already setted!!
01-05 01:07:53.564: D/AndroidRuntime(5712): readGMSProperty: end
01-05 01:07:53.589: D/dalvikvm(5712): Trying to load lib libjavacore.so 0x0
01-05 01:07:53.599: D/dalvikvm(5712): Added shared lib libjavacore.so 0x0
01-05 01:07:53.609: D/dalvikvm(5712): Trying to load …
Run Code Online (Sandbox Code Playgroud) 我使用uiautomatorviewer来做UI自动化.但是当我尝试拍摄快照以列出UI时,它显示adb未安装.
以下是我的xmls
主视图
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Your content -->
<include layout="@layout/content_main"/>
<!-- Bottom Sheet -->
<include layout="@layout/main_bottom_sheet"/>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
底部图纸视图
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_navigation_sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical"
app:behavior_peekHeight="56dp"
app:layout_behavior="@string/bottom_sheet_behavior">
<FrameLayout
android:id="@+id/fragment_bottom_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
回收视图屏幕
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:background="@color/alabaster"
android:elevation="@dimen/elevation_normal"
android:orientation="horizontal"
tools:targetApi="lollipop">
<FrameLayout
android:id="@+id/search_as_you_type_back_button"
android:layout_width="@dimen/toolbar_height"
android:layout_height="@dimen/toolbar_height"
android:foreground="?selectableItemBackground">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:contentDescription="@string/accessibility_back"
app:srcCompat="@drawable/ic_arrow_back"/>
</FrameLayout>
<EditText
android:id="@+id/search_as_you_type_edit_text"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/margin_medium"
android:layout_weight="1"
android:background="@color/transparent" …
Run Code Online (Sandbox Code Playgroud)