Skip to content

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

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

Open
ampeixoto opened this issue Jun 9, 2022 · 3 comments

Comments

@ampeixoto
Copy link

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
Copy link
Author

@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

@zbynek
Copy link
Contributor

zbynek commented Jun 9, 2022

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

@ampeixoto
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants