Code Monkey home page Code Monkey logo

Comments (13)

tonilopezmr avatar tonilopezmr commented on June 5, 2024 1

Can you share more information about your build.gradle with your configuration?
Or share a complete example to reproduce the error?

Thanks!!

from shot.

Serchinastico avatar Serchinastico commented on June 5, 2024 1

Hi @emilioscy, I'm seeing your project has both, Shot and Facebook's Screenshot library included. This will override the dependency Shot is using internally and will produce strange behaviors. I recommend not mixing both and stick to one of them.

from shot.

emilioscy avatar emilioscy commented on June 5, 2024 1

Hello @Serchinastico, i removed Facebook's library and works as expected. Perhaps this is what was causing the issue for @slacklab.

from shot.

slacklab avatar slacklab commented on June 5, 2024

@tonilopezmr
in build.gradle(Project)

classpath 'com.karumi:shot:3.0.2'

in app/build.gradle(Module)

 // Standard Android View Plugins (TextView, etc)
    implementation "com.facebook.testing.screenshot:layout-hierarchy-common:0.11.0"

    // Litho Component Plugins
    implementation "com.facebook.testing.screenshot:layout-hierarchy-litho:0.11.0"

shot {
    appId = 'com.kg.project'
    instrumentationTestTask = 'connectedDevDebugAndroidTest'
}

// setup for facebook screenshot plugin
screenshots {
    referenceDir = "$projectDir/build/outputs/screenshots"
    multipleDevices true
}

Can you give me some advice?

from shot.

tonilopezmr avatar tonilopezmr commented on June 5, 2024

Thanks! @slacklab, during next month we will take a look at this issue to solve it, in the meantime, if you have more informatión to share or you found the solution and want to make a PR with the fix is more than welcome.

from shot.

pedrovgs avatar pedrovgs commented on June 5, 2024

@slacklab could you please ensure you are not adding this dependency to your build.gradle file? com.facebook.testing.screenshot:core The error you reported is generated because any part of your code is importing that dependency with a version greater than 0.8.0 which is the last version we support right now. Could you check your dependencies and let me know if this facebook dependency is declared?

If the dependency is not declared, could you please run ./gradlew app:dependencies and paste the output of the command in a comment?

from shot.

pedrovgs avatar pedrovgs commented on June 5, 2024

Please, try also to remove these dependencies you declared in your manifest if my previous comment didn't fix the issue.

    // Standard Android View Plugins (TextView, etc)
    implementation "com.facebook.testing.screenshot:layout-hierarchy-common:0.11.0"

    // Litho Component Plugins
    implementation "com.facebook.testing.screenshot:layout-hierarchy-litho:0.11.0"

from shot.

ivan399 avatar ivan399 commented on June 5, 2024

@pedrovgs

Hello !

If you remove this dependence - the test will fail with such an error.

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.facebook.testing.screenshot.internal.ScreenshotImpl.runCallableOnUiThread(ScreenshotImpl.java:335)
at com.facebook.testing.screenshot.internal.ScreenshotImpl.storeBitmap(ScreenshotImpl.java:157)
at com.facebook.testing.screenshot.internal.ScreenshotImpl.record(ScreenshotImpl.java:261)
at com.facebook.testing.screenshot.internal.RecordBuilderImpl.record(RecordBuilderImpl.java:155)
at com.myapp.present.Suite.test(Suite.kt:417)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at androidx.test.rule.GrantPermissionRule$RequestPermissionStatement.evaluate(GrantPermissionRule.java:134)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at androidx.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:531)
at androidx.test.rule.GrantPermissionRule$RequestPermissionStatement.evaluate(GrantPermissionRule.java:134)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:392)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1955)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.facebook.testing.screenshot.WindowAttachment.invokeUnchecked(WindowAttachment.java:103)
at com.facebook.testing.screenshot.WindowAttachment.invoke(WindowAttachment.java:94)
at com.facebook.testing.screenshot.WindowAttachment.dispatchAttach(WindowAttachment.java:83)
at com.facebook.testing.screenshot.internal.ScreenshotImpl.storeBitmap(ScreenshotImpl.java:173)
at com.facebook.testing.screenshot.internal.ScreenshotImpl.access$000(ScreenshotImpl.java:47)
at com.facebook.testing.screenshot.internal.ScreenshotImpl$2.call(ScreenshotImpl.java:161)
at com.facebook.testing.screenshot.internal.ScreenshotImpl$2.call(ScreenshotImpl.java:158)
at com.facebook.testing.screenshot.internal.ScreenshotImpl$3.run(ScreenshotImpl.java:317)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6394)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1000)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:890)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.testing.screenshot.WindowAttachment.invokeUnchecked(WindowAttachment.java:101)
... 14 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.ViewRootImpl.addWindowCallbacks(android.view.WindowCallbacks)' on a null object reference
at com.android.internal.policy.DecorView.onAttachedToWindow(DecorView.java:1566)
... 16 more

./gradlew app:dependencies

What lines are interested in this command? In the output did not find Facebook dependencies

from shot.

pedrovgs avatar pedrovgs commented on June 5, 2024

@ivan399 I'm afraid looking at the trace I don't understand where the NPE comes from. Could you please upload a zip file or create a GitHub repository with a reproducing the error?

from shot.

ivan399 avatar ivan399 commented on June 5, 2024

@pedrovgs

I don’t have the right to publicly upload a project or part of it :(

But I found a similar problem: facebook/screenshot-tests-for-android#68

from shot.

pedrovgs avatar pedrovgs commented on June 5, 2024

@ivan399 I don't mean uploading the code of the app you are working on right now. I mean uploading any sample project you could create reproducing the error.

from shot.

emilioscy avatar emilioscy commented on June 5, 2024

Here is a test project that produces this specific error.
https://github.com/emilioscy/MFSNapshotTest

from shot.

Serchinastico avatar Serchinastico commented on June 5, 2024

I'm closing the issue. There is already a small section on the README describing problems if you load your own facebook dependency and how the current version of Shot is only compatible with FB's 0.8.0

from shot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.