Unexpected error while obtaining ui hierarchy java lang reflect invocationtargetexception

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

Failed to get device screenshot — Pixel 2 XL #46

Failed to get device screenshot — Pixel 2 XL #46

Comments

First off, I absolutely love this project. I really appreciate the work you’ve put into it.

I was using it on a Pixel XL (updated to 8.0) up until yesterday, and it was working fine. Then, however, I switched to a Pixel 2 XL, and the following happens.

If I set the screensize manually (to ), I get:

14:04:12 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 02:04:13 E/Screenshot: Unsupported protocol: 2 14:04:13 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 02:04:13 E/Screenshot: Unsupported protocol: 2 14:04:13 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 02:04:13 E/Screenshot: Unsupported protocol: 2 14:04:13 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 02:04:13 E/Screenshot: Unsupported protocol: 2 14:04:13 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 02:04:13 E/Screenshot: Unsupported protocol: 2 14:04:13 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 02:04:13 E/Screenshot: Unsupported protocol: 2 14:04:13 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 02:04:13 E/Screenshot: Unsupported protocol: 2 14:04:13 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 02:04:13 E/Screenshot: Unsupported protocol: 2 14:04:13 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 14:04:14 [AWT-EventQueue-0] INFO AndroidScreencastApplication — Stopping application 14:04:14 [Screen Capturer] WARN ScreenCaptureRunnable — IO Exception happened while getting device screenshot. Will try again in 100 ms. 14:04:14 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 14:04:14 [Screen Capturer] INFO ScreenCaptureRunnable — Stopping screen capturing 14:04:15 [Thread-1] INFO AndroidScreencastApplication — Stopping application

Читайте также:  Как работает html верстальщик

If I leave the screen size undefined (not set in app.properties) I get:

14:05:29 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 14:05:29 [Screen Capturer] WARN ScreenCaptureRunnable — ADB Command was rejected. Will try again in 100 ms. 14:05:29 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 14:05:29 [Screen Capturer] WARN ScreenCaptureRunnable — ADB Command was rejected. Will try again in 100 ms. 14:05:29 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 14:05:29 [Screen Capturer] WARN ScreenCaptureRunnable — ADB Command was rejected. Will try again in 100 ms. 14:05:29 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 14:05:29 [Screen Capturer] WARN ScreenCaptureRunnable — ADB Command was rejected. Will try again in 100 ms. 14:05:29 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 14:05:29 [Screen Capturer] WARN ScreenCaptureRunnable — ADB Command was rejected. Will try again in 100 ms. 14:05:29 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 14:05:29 [Screen Capturer] WARN ScreenCaptureRunnable — ADB Command was rejected. Will try again in 100 ms. 14:05:30 [Screen Capturer] INFO ScreenCaptureRunnable — Failed to get device screenshot 14:05:30 [Screen Capturer] WARN ScreenCaptureRunnable — ADB Command was rejected. Will try again in 100 ms.

Controls via buttons still work. it’s just the screenshot capability which isn’t.

The text was updated successfully, but these errors were encountered:

Источник

Uiautomatorviewer Error: Unexpected error while obtaining UI hierarchy java.lang.reflect.InvocationT…

After Android 8, the UI Automator of the SDK is opened directly, and the machine interface information cannot be intercepted.

It is recommended that you can use the following methods to intercept manually

adb shell uiautomator dump /sdcard/ sc.uix

Note: the new mobile address is changed to/data/local/TMP/*. Uix

adb shell screencap -p /sdcard/ sc.png

3. Open the uiautomatorviewer.bat , import the screenshot and resource file obtained from the machine

3、 Screenshot after solution

Read More:

  • [Solved] java.lang.reflect.InaccessibleObjectException: Unable to make protected java.net.http.HttpRequest()…
  • [Solved] Error: exception: java.lang.reflect.InvocationTargetException: null
  • Java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer; error resolution
  • Hive ERROR Failed with exception java.io.IOException:java.lang.IllegalArgumentException
  • Idea Error: java: java.lang.OutOfMemoryError: GC overhead limit exceeded
  • Error during job, obtaining debugging information [How to Solve]
  • [Solved] Response Export error on submit request on future invoke, java.lang.OutOfMemoryError: Java heap space
  • [Solved] jhat Analyzes dump File Error: java.lang.OutOfMemoryError
  • Spark Error: java.lang.StackOverflowError [How to Solve]
  • [Solved] Hadoop error java.lang.nosuchmethoderror
  • [Android Error] java.lang.RuntimeException: An error occurred while executing doInBackground()
  • [Solved] Wwagger error: java.lang.NumberFormatException: For input string: ““
  • JPA @ManyToMany java.lang.StackOverflowError: null [How to Solve]
  • [Solved] Request processing failed; nested exception is java.lang.NullPointerException
  • [Solved] java.lang.IllegalStateException: Cannot get a STRING value from a NUMERIC cell
  • [Solved] Non-fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: library “libmmkv.so“ not found
  • Tomcat startup error: java.lang.NoClassDefFoundError
  • [Solved] JMeter Server Command line pressure measurement: Error in NonGUIDriver java.lang.IllegalArgumentException
  • [Solved] Weblogic startup error: java.lang.NoClassDefFoundError

Источник

uiautomatorviewer не работает на последней версии MacOS

Я пытаюсь использовать uiautomatorviewer на MacOS 10.15. Я получил ошибку ниже.

enter image description here

Я тестировал uiautomatorviewer на MacOS 10.13. это работает очень хорошо.

Unexpected error while obtaining UI hierarchy java.lang.reflect.InvocationTargetException on latest Mac OS 
Unhandled event loop exception during blocked modal context. org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Unknown Source) at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:173) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:388) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507) at com.android.uiautomator.actions.ScreenshotAction.run(ScreenshotAction.java:85) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at ialogs.ProgressMonitorDialog$ProgressMonitor.subTask(ProgressMonitorDialog.java:234) 

2 ответа

Эта проблема возникает для версии SDK. Я решил свою проблему, выполнив следующие действия —

Установите env в свой bash_profile. сделать это

перейдите на MAC-ДИСК и найдите «.bash_profile» Откройте, отредактируйте и установите путь

export ANDROID_HOME=~/Library/Android/sdk export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home export PATH=$PATH:$JAVA_HOME/bin export PATH=$PATH:$JAVA_HOME/lib export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/build-tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH:$ANDROID_HOME/tools/lib/x86_64 

Выйдите из терминала и снова откройте «uiautomatorviewer» и нажмите Enter .

TL; DR: В моем случае сработало понижение версии Java, которую я использовал.

Чтобы быстро сделать это, я рекомендую установить sdkman и установить более раннюю версию текущей версии Java.

В моем случае я использовал 8.0.262.hs-adpt (как указано в SDKman) и имел проблемы, такие как отсутствие видимых исключений текстового / нулевого указателя на терминале.

После перехода на 8.0.252.hs-adpt все ошибки исчезли и в настоящее время работают.

  1. Установите SDKman (один лайнер: curl -s «https://get.sdkman.io» | bash )
  2. Откройте новую вкладку / терминал
  3. Найдите в SDKman JDK ниже, чем 8.0.262 : sdk list java (в моем случае это AdoptOpenJDK 8.0.252.hs-adpt )
  4. Установите его с помощью sdk install java
  5. Запустите uiautomatorviewer в том же терминале, в котором вы установили JDK.

Вы также можете использовать sdk use java , если у вас уже установлен другой JDK, или sdk default java , если вы хотите, чтобы вы всегда указывали на определенную версию.

Источник

Оцените статью