question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AGP 3.4.0 doesn't play with Android Test Orchestrator (not AndroidX version): ERROR: could not find class 'android.support.test.services.shellexecutor.ShellMain'

See original GitHub issue

Description

I’m not sure if this is a Testing issue or an AGP issue.

Running instrumentation tests with AGP 3.4.0 and Test Orchestrator 1.0.2 causes process crash.

Steps to Reproduce

I have repro steps and a reproducible repo here https://github.com/tir38/android-test-orchestrator-bug

  1. create brand new A/S project
  2. see that AGP is set to ‘com.android.tools.build:gradle:3.4.0-beta05’
  3. add Android Test Orchestrator to project (not the AndroidX version)
  4. start up an emulator
  5. run the instrumentation test that was included in brand new project:
$ ./gradlew clean app:connectedDebugAndroidTest
  1. see the tests fail:

Task :app:connectedDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:app:connectedDebugAndroidTest’. There were failing tests. See the report at: file:…/app/build/reports/androidTests/connected/index.html
  1. open report and see:

No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don’t inherit from TestCase or lack @Test annotations).

  1. look at the logs on the emulator. see tombstone
JNI DETECTED ERROR IN APPLICATION: 
JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: 
Didn't find class "android.support.test.services.shellexecutor.ShellMain" on path:...

Expected Results

Test should pass

Actual Results

Test process crashes

AndroidX Test and Android OS Versions

  • Not on androidX yet
  • Emulator running Android SDK 27

Link to a public git repo demonstrating the problem:

https://github.com/tir38/android-test-orchestrator-bug

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

10reactions
danielgomezricocommented, May 21, 2019

@tir38 How did you declare the dependency?

In my case I had it:

androidTestImplementation ‘androidx.test:orchestrator:1.1.0’

but it should be:

androidTestUtil ‘androidx.test:orchestrator:1.1.0’

After I made this change it worked fine.

3reactions
nickpalmercommented, May 15, 2019

Note that testing does work correctly with AndroidX Orchestrator. Changing the following two lines fixes things.

defaultConfig {
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
testOptions {
    execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Test Orchestrator not working with Android X
from looking at the above: It seems like it is trying to execute this command with android support version as opposed to the...
Read more >
android test orchestrator no tests found, android test class not found ...
As Android Test Orchestrator runs each test in a separate instrumentation a crash would crash just that instrumentation and not affect the rest...
Read more >
Virtual Device testing for Android step doesn't work properly ...
Hi, I am running android UI Tests with Espresso. I am using Android Test Orchestrator and have set clear app data between tests...
Read more >
godot Godot Web Editor not using/allowing gles3 - Cplusplus
Even though the editor may say that is using GLES 3, all the objects and the editor itself still act as if it's...
Read more >
Espresso 设置说明| Android 开发者
添加新的Android Tests 配置。 选择一个模块。 添加特定的插桩测试运行程序: androidx.test.runner.AndroidJUnitRunner; 运行新创建的配置 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found