forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix emulator tests. #5100
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
Merged
Merged
Fix emulator tests. #5100
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8c2c159 to
bcb4083
Compare
AGP_VERSION for emulator tests.bcb4083 to
97601c2
Compare
97601c2 to
c614d85
Compare
I see success, at least in the one time I tried after my final fix: [23](https://github.com/google/dagger/actions/runs/21265421466/job/61203969922?pr=5100), [26](https://github.com/google/dagger/actions/runs/21265421466/job/61203969919?pr=5100), [30](https://github.com/google/dagger/actions/runs/21265421466/job/61203969910?pr=5100). Those each took around 15 minutes or more, so that's probably slower than the ~13m on [the Hilt job](https://github.com/google/dagger/actions/runs/21265421466/job/61203969888?pr=5100). So it presumably makes sense to keep the emulator tests running only after merges to `master`, rather than running them on pull requests, even if we charitably assume that my fix will keep them working reliably. ### Set `AGP_VERSION` That fixes [this error](https://github.com/google/dagger/actions/runs/21227691196/job/61079454578#step:3:466): ``` > Could not resolve all artifacts for configuration 'classpath'. > Could not find com.android.tools.build:gradle:null. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/null/gradle-null.pom - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/null/gradle-null.pom - file:/home/runner/.m2/repository/com/android/tools/build/gradle/null/gradle-null.pom Required by: buildscript of root project 'Simple Hilt Android' > Could not find com.android.legacy-kapt:com.android.legacy-kapt.gradle.plugin:null. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/legacy-kapt/com.android.legacy-kapt.gradle.plugin/null/com.android.legacy-kapt.gradle.plugin-null.pom - https://repo.maven.apache.org/maven2/com/android/legacy-kapt/com.android.legacy-kapt.gradle.plugin/null/com.android.legacy-kapt.gradle.plugin-null.pom - file:/home/runner/.m2/repository/com/android/legacy-kapt/com.android.legacy-kapt.gradle.plugin/null/com.android.legacy-kapt.gradle.plugin-null.pom Required by: buildscript of root project 'Simple Hilt Android' ``` ### Fix `sourceSets` configuration That fixes [this error](https://github.com/google/dagger/actions/runs/21261143612/job/61189377362#step:3:760): ``` error: [Hilt] Type <error> not present: java.lang.TypeNotPresentException: Type <error> not present at dagger.spi.internal.shaded.androidx.room3.compiler.processing.javac.JavacAnnotationValueKt$UNWRAP_VISITOR$1.visitString(JavacAnnotationValue.kt:72) at dagger.spi.internal.shaded.androidx.room3.compiler.processing.javac.JavacAnnotationValueKt$UNWRAP_VISITOR$1.visitString(JavacAnnotationValue.kt:53) at jdk.compiler/com.sun.tools.javac.code.Attribute$Error.accept(Attribute.java:397) at java.compiler@21.0.10/javax.lang.model.util.AbstractAnnotationValueVisitor6.visit(AbstractAnnotationValueVisitor6.java:90) at dagger.spi.internal.shaded.androidx.room3.compiler.processing.javac.JavacAnnotationValue._init_$lambda$0(JavacAnnotationValue.kt:38) at dagger.spi.internal.shaded.androidx.room3.compiler.processing.javac.JavacAnnotationValue.value_delegate$lambda$0(JavacAnnotationValue.kt:47) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:86) at dagger.spi.internal.shaded.androidx.room3.compiler.processing.javac.JavacAnnotationValue.getValue(JavacAnnotationValue.kt:47) at dagger.spi.internal.shaded.androidx.room3.compiler.processing.XAnnotationValue.asType(XAnnotationValue.kt:60) at dagger.spi.internal.shaded.androidx.room3.compiler.processing.XAnnotation.getAsType(XAnnotation.kt:75) at dagger.hilt.android.processor.internal.customtestapplication.CustomTestApplicationMetadata.getBaseElement(CustomTestApplicationMetadata.java:73) at dagger.hilt.android.processor.internal.customtestapplication.CustomTestApplicationMetadata.of(CustomTestApplicationMetadata.java:64) at dagger.hilt.android.processor.internal.customtestapplication.CustomTestApplicationProcessingStep.processEach(CustomTestApplicationProcessingStep.java:40) at dagger.hilt.processor.internal.BaseProcessingStep.process(BaseProcessingStep.java:116) at dagger.hilt.android.processor.internal.customtestapplication.CustomTestApplicationProcessingStep.process(CustomTestApplicationProcessingStep.java:27) at dagger.spi.internal.shaded.androidx.room3.compiler.processing.CommonProcessorDelegate.processRound(XBasicAnnotationProcessor.kt:134) at dagger.spi.internal.shaded.androidx.room3.compiler.processing.javac.JavacBasicAnnotationProcessor.process(JavacBasicAnnotationProcessor.kt:75) ... [Hilt] Processing did not complete. See error above for details. /home/runner/work/dagger/dagger/javatests/artifacts/hilt-android/simple/app/src/androidTest/java/dagger/hilt/android/simple/CustomTestApplicationTest.java:24: error: package dagger.hilt.android.simple.BaseTestApplication does not exist import dagger.hilt.android.simple.BaseTestApplication.Foo; ^ /home/runner/work/dagger/dagger/javatests/artifacts/hilt-android/simple/app/src/androidTest/java/dagger/hilt/android/simple/SimpleEmulatorTestRunner.java:25: error: cannot find symbol @CustomTestApplication(BaseTestApplication.class) ^ symbol: class BaseTestApplication 3 errors ``` ### Add `androidx.test:runner` deps That fixes [this error](https://github.com/google/dagger/actions/runs/21261773438/job/61191426719?pr=5100#step:3:1289): ``` java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{dagger.hilt.android.simple.feature.test/androidx.test.runner.AndroidJUnitRunner}: java.lang.ClassNotFoundException: Didn't find class "androidx.test.runner.AndroidJUnitRunner" on path: DexPathList[[zip file "/data/app/~~29WTUxCgOzLabNLQzJ8kYg==/dagger.hilt.android.simple.feature.test-tzT2A65wdeKUNb9A4DoDzA==/base.apk"],nativeLibraryDirectories=[/data/app/~~29WTUxCgOzLabNLQzJ8kYg==/dagger.hilt.android.simple.feature.test-tzT2A65wdeKUNb9A4DoDzA==/lib/x86, /system/lib, /system_ext/lib]] ``` ### Make Proguard keep more Kotlin APIs That fixes [this error](https://github.com/google/dagger/actions/runs/21263645032/job/61197804944#step:3:2455): ``` java.lang.NoSuchMethodError: No direct method <init>(I)V in class Lkotlin/jvm/internal/Lambda; or its super classes (declaration of 'kotlin.jvm.internal.Lambda' appears in /data/app/dagger.lazyclasskey-pi80cZHtWbrAHi92wBPzsA==/base.apk) at androidx.test.platform.io.OutputDirCalculator$outputDir$2.<init>(OutputDirCalculator.kt:0) at androidx.test.platform.io.OutputDirCalculator.<init>(OutputDirCalculator.kt:27) at androidx.test.platform.io.FileTestStorage.<init>(FileTestStorage.java:45) at androidx.test.runner.AndroidJUnitRunner.registerTestStorage(AndroidJUnitRunner.java:664) at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:441) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2074) ``` RELNOTES=n/a PiperOrigin-RevId: 859792812
c614d85 to
7a370d9
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix emulator tests.
I see success, at least in the one time I tried after my final fix: 23, 26, 30.
Those each took around 15 minutes or more, so that's probably slower than the ~13m on the Hilt job. So it presumably makes sense to keep the emulator tests running only after merges to
master, rather than running them on pull requests, even if we charitably assume that my fix will keep them working reliably.Set
AGP_VERSIONThat fixes this error:
Fix
sourceSetsconfigurationThat fixes this error:
Add
androidx.test:runnerdepsThat fixes this error:
Make Proguard keep more Kotlin APIs
That fixes this error:
RELNOTES=n/a