Daniel Dudek
Daniel Dudek

Reputation: 525

Android Studio 3.6 Test framework quit unexpectedly, Crash of orchestrator

I'm having hard time running instrumented tests in Android Studio.

When I try try to run multiple test cases, "Test framework quit unexpectedly" shows up:

Android studio test framework quit unexpectedly screenshot

... and all the tests continue to run in the emulator, but Android Studio is not getting the results back.

Logcat shows this:

...
03-17 11:38:59.236  1699  1719 W ActivityManager: Scheduling restart of crashed service androidx.test.orchestrator/.OrchestratorService in 1000ms
03-17 11:38:59.236  1699  1719 W ActivityManager: Crash of app androidx.test.orchestrator running instrumentation ComponentInfo{androidx.test.orchestrator/androidx.test.orchestrator.AndroidTestOrchestrator}
03-17 11:38:59.236  1699  1721 W zygote  : kill(-8537, 9) failed: No such process
03-17 11:38:59.238  1699 13861 W Binder  : Outgoing transactions from this process must be FLAG_ONEWAY
03-17 11:38:59.238  1699 13861 W Binder  : java.lang.Throwable
03-17 11:38:59.238  1699 13861 W Binder  :  at android.os.BinderProxy.transact(Binder.java:752)
03-17 11:38:59.238  1699 13861 W Binder  :  at android.app.IInstrumentationWatcher$Stub$Proxy.instrumentationFinished(IInstrumentationWatcher.java:160)
03-17 11:38:59.238  1699 13861 W Binder  :  at com.android.server.am.InstrumentationReporter$MyThread.run(InstrumentationReporter.java:86)
03-17 11:38:59.281  1699  1721 W zygote  : kill(-8537, 9) failed: No such process
03-17 11:38:59.323  1699  1721 W zygote  : kill(-8537, 9) failed: No such process
03-17 11:38:59.353 13845 13845 W app_process: Unexpected CPU variant for X86 using defaults: x86
03-17 11:38:59.362  1699  1721 W zygote  : kill(-8537, 9) failed: No such process
03-17 11:38:59.385  1699  1741 W PackageManager: Code path for androidx.test.orchestrator changing from /data/app/androidx.test.orchestrator-fgDRlA7iNSNiyWm4dLj4hg== to /data/app/androidx.test.orchestrator-6QljegpCqjAHwDuS_O9G9Q==
03-17 11:38:59.385  1699  1741 W PackageManager: Resource path for androidx.test.orchestrator changing from /data/app/androidx.test.orchestrator-fgDRlA7iNSNiyWm4dLj4hg== to /data/app/androidx.test.orchestrator-6QljegpCqjAHwDuS_O9G9Q==
03-17 11:38:59.424 13845 13870 W MessageQueue: Handler (android.os.Handler) {9320712} sending message to a Handler on a dead thread
03-17 11:38:59.424 13845 13870 W MessageQueue: java.lang.IllegalStateException: Handler (android.os.Handler) {9320712} sending message to a Handler on a dead thread
03-17 11:38:59.424 13845 13870 W MessageQueue:  at android.os.MessageQueue.enqueueMessage(MessageQueue.java:545)
03-17 11:38:59.424 13845 13870 W MessageQueue:  at android.os.Handler.enqueueMessage(Handler.java:662)
03-17 11:38:59.424 13845 13870 W MessageQueue:  at android.os.Handler.sendMessageAtTime(Handler.java:631)
03-17 11:38:59.424 13845 13870 W MessageQueue:  at android.os.Handler.sendMessageDelayed(Handler.java:601)
03-17 11:38:59.424 13845 13870 W MessageQueue:  at android.os.Handler.post(Handler.java:357)
03-17 11:38:59.424 13845 13870 W MessageQueue:  at android.os.ResultReceiver$MyResultReceiver.send(ResultReceiver.java:57)
03-17 11:38:59.424 13845 13870 W MessageQueue:  at com.android.internal.os.IResultReceiver$Stub.onTransact(IResultReceiver.java:58)
03-17 11:38:59.424 13845 13870 W MessageQueue:  at android.os.Binder.execTransact(Binder.java:697)
03-17 11:38:59.436 13768 13850 W zygote  : Long monitor contention with owner firebase-iid-executor (13808) at void java.lang.AbstractStringBuilder.ensureCapacityInternal(int)(AbstractStringBuilder.java:124) waiters=0 in java.util.TimeZone java.util.TimeZone.getTimeZone(java.lang.String) for 114ms
03-17 11:38:59.519 13768 13768 W ResourceType: Failure getting entry for 0x7f0c0112 (t=11 e=274) (error -75)
03-17 11:38:59.520 13768 13768 W ResourceType: Failure getting entry for 0x7f0c0113 (t=11 e=275) (error -75)
03-17 11:38:59.608  1571  1809 E         : Couldn't opendir /data/app/vmdl185214765.tmp: No such file or directory
03-17 11:38:59.608  1571  1809 E installd: Failed to delete /data/app/vmdl185214765.tmp: No such file or directory
03-17 11:38:59.695  1699  1719 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:androidx.test.orchestrator flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy
03-17 11:38:59.702  1699  1719 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:androidx.test.orchestrator flg=0x4000010 (has extras) } to com.google.android.gms/.photos.autobackup.PhotosAppUninstalledReceiver
...

My test dependencies:

    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-web:3.2.0'
    androidTestImplementation ('androidx.test.espresso:espresso-contrib:3.2.0') {
        exclude module: 'support-compat'
    }
    androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
    androidTestImplementation 'androidx.test:core:1.2.0'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test:rules:1.2.0'
    androidTestUtil 'androidx.test:orchestrator:1.2.0'
    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'

I've found few references of both "Test framework quit unexpectedly" and "Outgoing transactions from this process must be FLAG_ONEWAY" to disabling instant run in Android Studio, but since 3.5 there is no Instant run, it's renamed to Apply code changes, and I can't see any options to turn it off.

Any ideas how to proceed with this?

pls help.

Upvotes: 17

Views: 8288

Answers (8)

Niranjan
Niranjan

Reputation: 1909

Got same error in Android Studio 4.1, adding below dependency

androidTestImplementation "androidx.test.espresso:espresso-core:x.x.x"

along with adding

android {
    defaultConfig {
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
}

solved the problem

Upvotes: 7

Shizuku
Shizuku

Reputation: 157

As a complete beginner in testing, I got this error when I didn't add - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" in my module-level build.gradle file.

This might not be the case with others, but I solved it when adding this. As per the documentation

To use JUnit 4 test classes, make sure to specify AndroidJUnitRunner as the default test instrumentation runner in your project by including the following setting in your app's module-level build.gradle file:

So you could give it a try by adding this.

android {
    defaultConfig {
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
}

Upvotes: 4

MatPag
MatPag

Reputation: 44821

I'm on AS 4.1.1 and the bug is still there if you use fragment-testing artifact. None of the solutions above worked.

In my case what solved the problem was to exclude the core dependency from the artifact

debugImplementation ("androidx.fragment:fragment-testing:1.2.5", {
    exclude group: 'androidx.test', module: 'core'
})

Source

Upvotes: 10

Priyanthi
Priyanthi

Reputation: 1785

It worked for me when I did File->Invalidate Caches and Restart on Android 4.1,

Upvotes: 2

Rupesh Gaud
Rupesh Gaud

Reputation: 101

Removing or commenting below things doesn't solve the actual purpose:

testOptions {
//     execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

dependencies {
//    androidTestUtil 'androidx.test:orchestrator:1.2.0'
}

As per recommendation: https://developer.android.com/training/testing/junit-runner#ato-gradle , we should use this.

I too faced the same issue like while running test cases, "framework quit unexpectedly" message was coming because I was using 3.6.1 android studio version.

After updating android studio to 4.0.1 version, this issue has been resolved. I am now successfully able to execute all the test cases.

Upvotes: 0

Aung Thiha
Aung Thiha

Reputation: 1215

As Victor Carbalho mentioned, it's a bug in Android Studio 3.6.1 https://stackoverflow.com/a/60727631/2353939

I just disable orchestrator at the moment.

testOptions {
//     execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

dependencies {
//    androidTestUtil 'androidx.test:orchestrator:1.2.0'
}

Upvotes: 1

Shalbert
Shalbert

Reputation: 1154

Vitor Carvalho is correct that it's an Android Studio v3.6.1 issue. I resolved it by uninstalling Android Studio, and then downgrading back to v3.5.3.

To uninstall Android Studio, follow this answer's guidance, which essentially comes down to:

Execute these commands in the terminal (excluding the lines with hashtags - they're comments):

# Deletes the Android Studio application
# Note that this may be different depending on what you named the application as, or whether you downloaded the preview version
rm -Rf /Applications/Android\ Studio.app
# Delete All Android Studio related preferences
# The asterisk here should target all folders/files beginning with the string before it
rm -Rf ~/Library/Preferences/AndroidStudio*
# Deletes the Android Studio's plist file
rm -Rf ~/Library/Preferences/com.google.android.*
# Deletes the Android Emulator's plist file
rm -Rf ~/Library/Preferences/com.android.*
# Deletes mainly plugins (or at least according to what mine (Edric) contains)
rm -Rf ~/Library/Application\ Support/AndroidStudio*
# Deletes all logs that Android Studio outputs
rm -Rf ~/Library/Logs/AndroidStudio*
# Deletes Android Studio's caches
rm -Rf ~/Library/Caches/AndroidStudio*
# Deletes older versions of Android Studio
rm -Rf ~/.AndroidStudio*

Then, install a previous version of Android Studio from the Android Studio archive.

Upvotes: 1

Vitor Carvalho
Vitor Carvalho

Reputation: 56

Seems like its a Bug of AS 3.6.

According to this thread in Reddit: https://www.reddit.com/r/androiddev/comments/f9xsz2/anyone_else_having_issues_running_androidtest/

It will be fixed in 3.6.2.

Upvotes: 4

Related Questions