RockyGlobal
RockyGlobal

Reputation: 595

Unknown platform error occurred when running the UTP test suite

When trying to build android app Espresso Instrumentation Tests with circleci Unknown platform error occurred when running the UTP test suite.

Task :app:connectedDebugAndroidTest FAILED

Test results saved as file:/home/circleci/code/app/build/outputs/androidTest-results/connected/test-result.pb. Inspect these results in Android Studio by selecting Run > Import Tests From File from the menu bar and importing test-result.pb.

FAILURE: Build failed with an exception.

There were failing tests. See the report at: file:///home/circleci/code/app/build/reports/androidTests/connected/index.html

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 12s 74 actionable tasks: 1 executed, 73 up-to-date

<-------------> 0% WAITING> IDLEMax tries reached (2)

Exited with code exit status 1

Upvotes: 17

Views: 8090

Answers (6)

Y.A.P.
Y.A.P.

Reputation: 538

in my case what have fixed the issue was upgrading :

'com.android.tools.build:gradle:8.0.0'
-> 
'com.android.tools.build:gradle:8.4.2'

and

distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
->
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip

Upvotes: 0

victor orue
victor orue

Reputation: 1

The problem could be two things. The first is to verify if the Android dependencies are correctly implemented (there is a difference between androidTestImplementation and testImplementation) and also the folders. In Android, there are two folders, androidTest and test. I think you should choose test.

Upvotes: 0

C&#233;dric LE MOING
C&#233;dric LE MOING

Reputation: 176

Got the same problem after installing android studio on a new computer, and running instrumented tests on a connected device which I used previously to run my tests:

> Task :sdk-android:connectedDebugAndroidTest FAILED
Unknown platform error occurred when running the UTP test suite. Please check logs for details.

Then try again running those tests by command line with --debug option give more details about the problem:

./gradlew -Pandroid.testInstrumentationRunnerArguments.class=<MY_PACKAGE>.UnitTestSuite --debug

logs:

Caused by: com.google.testing.platform.core.error.UtpException: ErrorName: INSTALL_FAILED_UPDATE_INCOMPATIBLE
….
2023-02-14T16:32:41.454+0100 [ERROR] [org.gradle.api.Task] Unknown platform error occurred when running the UTP test suite. Please check logs for details.
2023-02-14T16:32:41.455+0100 [QUIET] [org.gradle.api.Task] 

So in my case, it was just a problem of adb being unable to update test app. Just remove it from the device, then it worked for me!

Upvotes: 5

Jesse Hill
Jesse Hill

Reputation: 1994

For us, the CI server had plenty of space remaining but we still encountered the Unknown platform error occurred when running the UTP test suite. error. I found that using the -wipe-data option when launching the emulator on our server resolved the issue. As per the documentation, using the -wipe-data option removed the app state that had been preserved across restarts and freed up the memory needed to run the tests.

The virtual device preserves the app and its state data across restarts, in a user-data disk partition (userdata-qemu.img). To clear this data, start the emulator with the -wipe-data option or wipe the data in the AVD Manager, for example. For more information about the user-data partition and other storage, see the following section.

The full example command is: emulator @AVD_NAME -wipe-data.

Upvotes: 0

Jerry Sha
Jerry Sha

Reputation: 3991

Saw a similar error when running a test on an emulator unrelated to circleci. It was due to lack of storage space. Freeing some memory and retrying fixed it.

Upvotes: 9

Jonathan
Jonathan

Reputation: 233

Have you tried to update your IDE? It looks like a bug to me

Upvotes: 0

Related Questions