-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't make Appium work with Compose 1.2.0 - java.lang.AbstractMethodError: abstract method "kotlin.coroutines.CoroutineContext$Key androidx.compose.ui.platform.InfiniteAnimationPolicy.getKey()" #812
Comments
What version of library versions did you provide? The espresso driver's dependencies are https://github.com/appium/appium-espresso-driver/blob/master/espresso-server/app/build.gradle.kts , so I guess you may need to add/update dependencies to fit for your test app configuration |
Library versions I provided so they would match versions in tested application
|
Thanks, what kind of dependencies in your app under test uses? I wonder if some of them are missing/incompatible with appium-espresso-driver/espresso-server/app/build.gradle.kts Lines 130 to 134 in 60fd588
Then, could you try to modify the build.gradle.kts directly? |
Hey @KazuCocoa, while trying to run Appium Espresso Driver Sessions on one of the sample jetpack compose sample apps (specifically Owl App). Found the exact same error loglines:
A Generic Question: How do we know what dependencies are missing/incompatible, in case of such errors? Appium Logs gist
|
https://github.com/appium/appium-espresso-driver/blob/master/espresso-server/app/build.gradle.kts is what appium espresso server resolves dependencies by default, so what dependencies are missing/incompatible is generally you may need to compare the dependencies between your production code and the espresso server. Probably https://github.com/android/compose-samples/blob/70d05efe9c5de6d3788ac3c6023caa20761d410a/Owl/gradle/libs.versions.toml is the dependency. I haven't deeply compared, but maybe you can try to set the same version of dependencies, missing ones as espresso config |
@radimjanda754 Have you resolved this issue ? Can you post your solution ? |
@KazuCocoa I have uploaded the sample to test Appium Espresso with the blank Android project. I have cloned both Android and the Espresso server projects, also create the script to run. Can you help me to find out what I was wrong ? https://github.com/toantk238/Test-Appium-Espresso-Driver |
Let me take a look by finding a chance |
@rock-tran unfortunately we still didn't manage to fix this issue. We are just trying different versions of appium driver (beta, rc) and some it works on some simple apps, but so far it never worked on the app we want to test. Thanks for posting sample project, it would be really nice if @KazuCocoa came up with something |
Tried a bit last night. Still getting a weird error, so need to take a look further though. It seems like the compose also has complicated dependencies... 1) startEspressoServer(io.appium.espressoserver.EspressoServerRunnerTest)
java.lang.IllegalStateException: The application under test must require android.permission.INTERNET permission in its manifest
at io.appium.espressoserver.lib.http.Server.start(Server.kt:93)
at io.appium.espressoserver.EspressoServerRunnerTest.startEspressoServer(EspressoServerRunnerTest.kt:67)
... 53 trimmed
Caused by: java.net.BindException: bind failed: EADDRINUSE (Address already in use)
at libcore.io.IoBridge.bind(IoBridge.java:108)
at java.net.PlainSocketImpl.socketBind(PlainSocketImpl.java:162)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:427)
at java.net.ServerSocket.bind(ServerSocket.java:377)
at java.net.ServerSocket.bind(ServerSocket.java:331)
at fi.iki.elonen.NanoHTTPD$ServerRunnable.run(NanoHTTPD.java:1761)
at java.lang.Thread.run(Thread.java:923)
Caused by: android.system.ErrnoException: bind failed: EADDRINUSE (Address already in use)
at libcore.io.Linux.bind(Native Method)
at libcore.io.ForwardingOs.bind(ForwardingOs.java:74)
at libcore.io.ForwardingOs.bind(ForwardingOs.java:74)
at libcore.io.IoBridge.bind(IoBridge.java:104)
... 6 more
FAILURES!!!
Tests run: 1, Failures: 1
(headspin) kazu$ git diff
diff --git a/android_app/app/src/main/AndroidManifest.xml b/android_app/app/src/main/AndroidManifest.xml
index 8d1f774..aa5abe7 100644
--- a/android_app/app/src/main/AndroidManifest.xml
+++ b/android_app/app/src/main/AndroidManifest.xml
@@ -2,6 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
diff --git a/android_test/app/build.gradle.kts b/android_test/app/build.gradle.kts
index 9b757ec..c445c57 100644
--- a/android_test/app/build.gradle.kts
+++ b/android_test/app/build.gradle.kts
@@ -4,7 +4,7 @@ plugins {
}
android {
- compileSdk = getIntProperty("appiumCompileSdk", 32)
+ compileSdk = getIntProperty("appiumCompileSdk", 33)
buildToolsVersion = getStringProperty("appiumBuildTools", "32.0.0")
defaultConfig {
// <instrumentation android:targetPackage=""/>
@@ -48,6 +48,14 @@ android {
keyPassword = "android"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
@@ -110,15 +118,8 @@ dependencies {
androidTestImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
androidTestImplementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
androidTestImplementation("androidx.compose.ui:ui-test:${composeVersion}")
- androidTestImplementation("androidx.compose.ui:ui-test-junit4:${composeVersion}") {
- isTransitive = false
- }
-
- // additionalAndroidTestDependencies placeholder (don't change or delete this line)
- androidTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
- androidTestImplementation("androidx.compose.ui:ui-test-manifest:1.2.1")
- androidTestImplementation("androidx.test.ext:junit:1.1.3")
- androidTestImplementation("com.google.truth:truth:1.1.3")
+ androidTestImplementation("androidx.compose.ui:ui-test-junit4:${composeVersion}")
+ androidTestImplementation("androidx.compose.ui:ui-test-manifest:${composeVersion}")
}
configurations.all {
@@ -141,7 +142,7 @@ object Version {
const val gson = "2.9.0"
const val uia = "2.2.0"
const val nanohttpd = "2.3.1"
- const val annotation = "1.3.0"
+ const val annotation = "1.2.0"
const val mockito = "4.0.0"
const val robolectric = "4.5.1"
const val junit = "4.13.2"
diff --git a/test.sh b/test.sh
index 60daf8c..6149578 100755 |
I fixed this by forcing androidx.compose.ui to 1.2.1, looks like there was a dependency conflict between testing and runtime deps |
Hi there! I'm facing same issue "fix" from chrisjenx doesn't help( any ideas?) |
For me setting androidx.compose.ui to 1.2.1 and setting minSdk to 24 (or newer) helps with the compose issue. I have set these versions in APK and toolsVersions too. However the Appium still doesn't work, as I'm already facing another weird issue while trying to run the tests:
|
@KazuCocoa I have updated dependencies based on your patch. Now, it hangs like this No exception or error. |
The build itself seems ok, the above behavior is expected |
@KazuCocoa I have tested appium with the test project above and it works. The env is here {
"name": "yourapp",
"version": "0.0.1",
"dependencies": {
"appium": "2.0.0-beta.46",
"appium-doctor": "1.16.2",
"appium-espresso-driver": "2.13.5",
"appium-uiautomator2-driver": "2.10.2"
}
}
However, it still doesn't work with my project, the more complex one. I will create another issue. I think you can close this. |
@KazuCocoa Do you have any plan to apply the patch into the repo soon ? |
@KazuCocoa Has the same issue with those logs: |
I wondered if #875 fixes this error in some cases. |
appium espresso driver 2.22.0 has the fix I found. Newer compose may work in some environments |
I'm using latest beta versions of appium (Appium v2.0.0-beta.42) and espresso driver, but I can't make it work with compose app.
I've tried even on empty compose Hello world project generated by Android studio (using compose version 1.2.0), but the appium still throws this error:
[debug] [EspressoDriver@d452 (d7e46f24)] [Instrumentation] io.appium.espressoserver.EspressoServerRunnerTest: [debug] [EspressoDriver@d452 (d7e46f24)] [Instrumentation] Error in startEspressoServer(io.appium.espressoserver.EspressoServerRunnerTest): [debug] [EspressoDriver@d452 (d7e46f24)] java.lang.AbstractMethodError: abstract method "kotlin.coroutines.CoroutineContext$Key androidx.compose.ui.platform.InfiniteAnimationPolicy.getKey()" [debug] [EspressoDriver@d452 (d7e46f24)] at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:33) [debug] [EspressoDriver@d452 (d7e46f24)] at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:32) [debug] [EspressoDriver@d452 (d7e46f24)] at kotlin.coroutines.CoroutineContext$Element$DefaultImpls.fold(CoroutineContext.kt:70) [debug] [EspressoDriver@d452 (d7e46f24)] at androidx.compose.ui.platform.InfiniteAnimationPolicy$DefaultImpls.fold(InfiniteAnimationPolicy.kt:36) [debug] [EspressoDriver@d452 (d7e46f24)] at androidx.compose.ui.test.AndroidComposeUiTestEnvironment$infiniteAnimationPolicy$1.fold(ComposeUiTest.android.kt:239) [debug] [EspressoDriver@d452 (d7e46f24)] at kotlin.coroutines.CoroutineContext$DefaultImpls.plus(CoroutineContext.kt:32) [debug] [EspressoDriver@d452 (d7e46f24)] at kotlin.coroutines.CombinedContext.plus(CoroutineContextImpl.kt:111) [debug] [EspressoDriver@d452 (d7e46f24)] at androidx.compose.ui.test.AndroidComposeUiTestEnvironment.<init>(ComposeUiTest.android.kt:248) [debug] [EspressoDriver@d452 (d7e46f24)] at androidx.compose.ui.test.junit4.AndroidComposeTestRule$special$$inlined$AndroidComposeUiTestEnvironment$1.<init>(ComposeUiTest.android.kt:203) [debug] [EspressoDriver@d452 (d7e46f24)] at androidx.compose.ui.test.junit4.AndroidComposeTestRule.<init>(AndroidComposeTestRule.android.kt:212) [debug] [EspressoDriver@d452 (d7e46f24)] at io.appium.espressoserver.EspressoServerRunnerTest.<init>(EspressoServerRunnerTest.kt:45)
Did anyone make appium espresso work with Compose?
The text was updated successfully, but these errors were encountered: