Tôi cho rằng bạn sẽ giải quyết nó kể từ tháng một, nhưng tôi làm việc với các công cụ dòng lệnh, tìm thấy vấn đề tương tự (thông báo lỗi là khác nhau t) và giải quyết nó như tôi giải thích trong các bước sau. Tôi làm toàn bộ quá trình từ việc tạo ra một dự án giả với thử nghiệm rỗng của nó cho đến khi chạy thử thành công.Tôi hy vọng nó có thể có ích cho ai đó:
Bước đầu tiên, tạo dự án:
android create project
--name MyExample
--target "Google Inc.:Google APIs:17"
--path MyExample
--package com.example
--activity MyExampleActivity
Thứ hai bước, tạo dự án thử nghiệm:
android create test-project
--path MyExampleTest
--name MyExampleTest
--main ../MyExample
Thứ ba bước, truy cập vào thư mục dự án của bạn, xây dựng nó và kiểm tra xem quá trình có kết thúc thành công hay không:
cd MyExample && ant debug
bước thứ tư, cài đặt nó vào giả lập:
adb -s emulator-5554 install -r bin/MyExample-debug.apk
bước Fifth, truy cập vào thư mục dự án thử nghiệm của bạn và cố gắng chạy các bài kiểm tra:
cd ../MyExampleTest &&
adb shell am instrument -w com.example.tests/android.test.InstrumentationTestRunner
Đó sản lượng:
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.example.tests/android.test.InstrumentationTestRunner}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: com.example.tests/android.test.InstrumentationTestRunner
at com.android.commands.am.Am.runInstrument(Am.java:676)
at com.android.commands.am.Am.run(Am.java:119)
at com.android.commands.am.Am.main(Am.java:82)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
at dalvik.system.NativeStart.main(Native Method)
Thứ sáu bước, liệt kê clases nhạc cụ của bạn và đảm bảo rằng dự án hiện tại của bạn là mất tích:
adb shell pm list instrumentation
Đó năng suất máy tính của tôi:
instrumentation:com.android.emulator.connectivity.test/android.test.InstrumentationTestRunner (target=com.android.emulator.connectivity.test)
instrumentation:com.android.emulator.gps.test/android.test.InstrumentationTestRunner (target=com.android.emulator.gps.test)
instrumentation:com.android.example.spinner.tests/android.test.InstrumentationTestRunner (target=com.android.example.spinner)
instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
instrumentation:com.android.smoketest.tests/android.test.InstrumentationTestRunner (target=com.android.smoketest)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
Như bạn có thể thấy, các thiết bị đo đạc cho com.example.tests
doesn không tồn tại, vì vậy chúng ta sẽ phải tạo ra nó.
Seventh bước, xây dựng cho bạn kiểm tra dự án và kiểm tra xem nó đã thành công:
ant debug
thứ tám bước, cài đặt nó vào giả lập:
adb -s emulator-5554 install -r bin/MyExampleTest-debug.apk
IX bước, liệt kê các lớp thiết bị đo đạc của bạn và tìm kiếm một trong các dự án của bạn:
adb shell pm list instrumentation
Đó suất:
instrumentation:com.android.emulator.connectivity.test/android.test.InstrumentationTestRunner (target=com.android.emulator.connectivity.test)
instrumentation:com.android.emulator.gps.test/android.test.InstrumentationTestRunner (target=com.android.emulator.gps.test)
instrumentation:com.android.example.spinner.tests/android.test.InstrumentationTestRunner (target=com.android.example.spinner)
instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
instrumentation:com.android.smoketest.tests/android.test.InstrumentationTestRunner (target=com.android.smoketest)
instrumentation:com.example.tests/android.test.InstrumentationTestRunner (target=com.example)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
Nhìn vào thứ hai để kéo dài, instrumentation:com.example.tests
, nó mà chúng tôi muốn.
thứ mười bước, chạy thử nghiệm của bạn:
adb shell am instrument -w com.example.tests/android.test.InstrumentationTestRunner
Đó suất:
Test results for InstrumentationTestRunner=
Time: 0.0
OK (0 tests)
Đó là tất cả. Bây giờ thực hiện các bài kiểm tra của bạn, biên dịch và cài đặt như bình thường.Ngoài ra, bạn có thể xóa chúng như:
adb shell pm uninstall com.example.tests
Nhưng bạn sẽ cần phải tạo lại các lớp thiết bị để tránh lỗi tương tự.
Cảm ơn bạn, cảm ơn bạn, cảm ơn bạn Birei! Hành động cài đặt đã giải quyết được vấn đề của tôi, vì đó là lý do tôi nhận được lỗi "Không thể tìm thấy thông tin thiết bị đo đạc" – gsaslis
Tôi đã kiểm tra theo cách của bạn nhưng không hoạt động. Và một điều nữa Trong bước thứ sáu tôi có thể nhìn thấy tên của dự án của tôi trong danh sách thiết bị đo đạc nhưng khi tôi đang cố gắng chạy thử nghiệm để nó cho lỗi giống như bạn mô tả ở trên. Làm ơn giúp tôi. –
bạn đã làm bất cứ điều gì tương tự với gradle? – c3rin