FirebaseTestLab-Android icon indicating copy to clipboard operation
FirebaseTestLab-Android copied to clipboard

class java.lang.Class cannot be cast to class com.appunite.firebasetestlabplugin.model.ScreenOrientation

Open ampeixoto opened this issue 3 years ago • 3 comments
trafficstars

I have created a separated gradle file in my project to setup this plugin in all my modules, as suggested here.

with-firebase.gradle

apply plugin: 'firebase.test.lab'

buildscript {
    repositories {
        google()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:${versions.androidToolsBuildGradle}"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
        classpath "firebase.test.lab:plugin:${versions.firebaseTestLab}"
    }
}

firebaseTestLab {
    keyFile = project.rootProject.file("config/service-account.json")
    googleProjectId = "my-project-id" // You can find it on https://console.cloud.google.com/home

    devices {
        samsungTabletPhysicalDevice {
            deviceIds = ["gts4lltevzw"]
            androidApiLevels = [28]
            isUseOrchestrator = true  // I recommend using the orchestrator, so that you ensure that all tests will be run
        }
    }
}

Then I add this line in the build.gradle of my modules: apply from: "$rootProject.projectDir/tools/with-firebase.gradle"

This works perfectly.

But now I want to force the orientation to LANDSCAPE.

So I changed the device configuration to:

devices {
        samsungTabletPhysicalDevice {
            deviceIds = ["gts4lltevzw"]
            androidApiLevels = [28]
            screenOrientations = [com.appunite.firebasetestlabplugin.model.ScreenOrientation.LANDSCAPE]
            isUseOrchestrator = true  // I recommend using the orchestrator, so that you ensure that all tests will be run
        }
}

But now I get the following error in my pipeline:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':features:cockpit:firebaseTestLabExecuteDebugInstrumentationSamsungTabletPhysicalDeviceDebug'.
> class java.lang.Class cannot be cast to class com.appunite.firebasetestlabplugin.model.ScreenOrientation (java.lang.Class is in module java.base of loader 'bootstrap'; com.appunite.firebasetestlabplugin.model.ScreenOrientation is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @45d82a93)
* 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 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
BUILD FAILED in 6m 34s

Any idea why?

ampeixoto avatar Jun 09 '22 10:06 ampeixoto

@piotrmadry I would like to push a branch to create a pull request that could fix this issue I believe. Can you give permission to push branch and create PR please?

remote: Permission to piotrmadry/FirebaseTestLab-Android.git denied to ampeixoto.
fatal: unable to access 'https://github.com/piotrmadry/FirebaseTestLab-Android.git/': The requested URL returned error: 403

ampeixoto avatar Jun 09 '22 10:06 ampeixoto

@ampeixoto the usual workflow is that you fork the repository and create the pull request from your fork (no permissions needed)

zbynek avatar Jun 09 '22 12:06 zbynek

@piotrmadry right! forgot about that option. Done. Looking forward to see your decision.

ampeixoto avatar Jun 09 '22 16:06 ampeixoto