-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
NPE recording screenshots #70
Comments
Can you share more information about your Thanks!! |
@tonilopezmr
in app/build.gradle(Module)
Can you give me some advice? |
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. |
@slacklab could you please ensure you are not adding this dependency to your If the dependency is not declared, could you please run |
Please, try also to remove these dependencies you declared in your manifest if my previous comment didn't fix the issue.
|
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
What lines are interested in this command? In the output did not find Facebook dependencies |
@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? |
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 |
@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. |
Here is a test project that produces this specific error. |
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. |
Hello @Serchinastico, i removed Facebook's library and works as expected. Perhaps this is what was causing the issue for @slacklab. |
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 |
I want to run yours plugin
I do:
./gradlew executeScreenshotTests -Precord
But get some errors:
But I found this Json at zip archive screenshot_bundle.zip
What I should do to avoid this error?
Thanks in advance
Version of the library
com.karumi:shot:3.0.2
The text was updated successfully, but these errors were encountered: