Repository navigation
[integration_test] readme about Android device testing out-of-date #62237
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsd: examplesSample code and demosSample code and demosf: integration_testThe flutter/packages/integration_test pluginThe flutter/packages/integration_test pluginplatform-androidAndroid applications specificallyAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Android"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
https://github.com/flutter/plugins/tree/master/packages/e2e#android-device-testing
Following this guide to a newly created (by flutter create) will result in fail:
+ ./gradlew app:assembleAndroidTest
> Task :app:compileDebugAndroidTestJavaWithJavac FAILED
/Users/minglyu/tmp/ftl_dev/android/app/src/androidTest/java/com/example/ftl_dev/MainActivityTest.java:11: error: cannot find symbo
public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class, true, false);
^
symbol: class MainActivity
location: class MainActivityTest
/Users/minglyu/tmp/ftl_dev/android/app/src/androidTest/java/com/example/ftl_dev/MainActivityTest.java:11: error: cannot find symbol
public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class, true, false);
^
symbol: class MainActivity
location: class MainActivityTest
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugAndroidTestJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
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.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.6.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s
It seems current flutter create is using kotlin but this guide is for java.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsd: examplesSample code and demosSample code and demosf: integration_testThe flutter/packages/integration_test pluginThe flutter/packages/integration_test pluginplatform-androidAndroid applications specificallyAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Android"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Activity
CareF commentedon Jul 24, 2020
@dnfield @digiter
dnfield commentedon Jul 24, 2020
We should have docs for both Kotlin and Java. It's still possible to
flutter createa Java app with the right flags.CareF commentedon Jul 25, 2020
Is it possible to automatically add these files when
flutter build/run/driveane2etest?1 remaining item
yshean commentedon Feb 27, 2023
What should be the code/setup for Kotlin?
novas1r1 commentedon Mar 15, 2023
@yshean did you figure it out?
I had the same problem and tried to fix it like this, but couldn't make it work.
Changing the path with the
MainActivityTest.javafrom:app/src/androidTest/java/com/example/myapptoapp/src/androidTest/kotlin/com/example/myappChanging the
MainActivityTest.javatoMainActivityTest.ktEntering the following code in
MainActivityTest.kt:I have no idea about Kotlin, so maybe someone could verify if this is at least the right direction?
adan-abdi commentedon Jun 8, 2023
@novas1r1 @CareF Did you find any solutions for this? I am getting the same issue trying to do Android device testing and cant generate androidTestApk for FirebaseTestLab
adan-abdi commentedon Jun 8, 2023
@novas1r1 Did you ensure the line at the top of your
MainActivityTest.java==> package com.example.myapp is changed to your app package id?novas1r1 commentedon Jun 8, 2023
@Abdi-adan for me it worked the way I provided it in my answer above. Yes, you need to change the first line to your package name.
nc-jeni commentedon Jan 31, 2024
I have done the exact same, but it does not find my tests nor any errors.
patrol test --flavor development
@novas1r1 (or anyone else) Do you know why?
Please find more details here leancodepl/patrol#2082
[integration_test] Update README to support modern Kotlin-based setup…
[integration_test] Update README to support modern Kotlin-based setup…
github-actions commentedon Jul 14, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.