Espelhando a tela do smartphone Android no Linux via Wi-Fi (ADB + SCRCPY)

Este artigo mostra como fazer, de maneira simples, o espelhamento da tela do seu celular na tela do seu Desktop ou Notebook usando os programas ADB e SCRCPY.

[ Hits: 9.387 ]

Por: andre uebe em 26/01/2023 | Blog: http://resa.net.br


Espelhando a tela do Smartphone com o SCRCPY



Com a tela do smartphone desbloqueada, abra o programa SCRCPY previamente instalado, por meio do menu de programas da sua distribuição Linux ou pelo terminal, digitando:

scrcpy
O resultado será algo do tipo:


Caso deseje assistir a algum filme, ative o modo paisagem do seu smartphone para fazer a tela girar. O resultado será algo do tipo:
E, agora, o teste final. Retirando-se o cabo USB o espelhamento deve continuar sem problemas, uma vez que o smartphone está conectado ao computador via Wi-Fi, pela porta 5555 do protocolo TCP/IP.

Página anterior    

Páginas do artigo
   1. O que são ADB e SCRCPY
   2. Configurando o ADB para acesso via Wi-Fi
   3. Espelhando a tela do Smartphone com o SCRCPY
Outros artigos deste autor

CmapTools: Gestão do Conhecimento através de Mapas Conceituais no Linux

Como submeter dados de CDDB de um CD de áudio ao Freedb

Facilitando o acesso a disquetes e memory keys (PenDrives) no Kurumin

Hippo Viewer: Cliente para acesso a mundos virtuais

Atualização do Firmware da BIOS do Dell Inspiron via Linux

Leitura recomendada

Emulando Cisco com Dynamips e Dynagen no Ubuntu

Integração MRTG e RRDTool

Aventuras, desventuras e Software Livre

História da informática: Um pouco de datas e especificações

QEMU - Para rodar Windows pré-instalado

  
Comentários
[1] Comentário enviado por fabio em 26/01/2023 - 06:28h

Ótimo artigo! Vou deixar minha contribuição aqui.

Usando Debian 11 o scrcpy está na versão 1.17, ao executar dá o seguinte erro:

$ scrcpy
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 0.8 MB/s (34015 bytes in 0.042s)
[server] INFO: Device: samsung SM-S908E (Android 13)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 470.161.03
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2312
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetExceptionWARN: Device disconnected

at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75)
at com.genymobile.scrcpy.ScreenEncoder.setDisplaySurface(ScreenEncoder.java:243)
at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:91)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
at com.genymobile.scrcpy.Server.main(Server.java:252)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:378)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73)
... 7 more
Caused by: java.lang.IllegalArgumentException: displayToken must not be null
at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:3693)
at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:2489)
... 9 more
WARN: Killing the server...

Para resolver foi necessário remover essa versão defasada e instalar uma versão superior a 1.18:

$ sudo apt remove scrcpy

Instale as dependências para compilar a última release do GitHub:

$ sudo apt install ffmpeg libsdl2-2.0-0 adb wget gcc git pkg-config meson ninja-build libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libusb-1.0-0 libusb-1.0-0-dev

Em seguida:

$ git clone https://github.com/Genymobile/scrcpy
$ cd scrcpy
$ ./install_release.sh

E agora instale o scrcpy:

$ ./install_release.sh

Fontes:
https://github.com/Genymobile/scrcpy/issues/2129
https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#simple

[2] Comentário enviado por maurixnovatrento em 26/01/2023 - 11:47h


Bom artigo;

___________________________________________________________
Conhecimento não se Leva para o Túmulo.
https://github.com/mxnt10

[3] Comentário enviado por andreuebe em 29/01/2023 - 12:27h


[1] Comentário enviado por fabio em 26/01/2023 - 06:28h

Ótimo artigo! Vou deixar minha contribuição aqui.

Usando Debian 11 o scrcpy está na versão 1.17, ao executar dá o seguinte erro:

$ scrcpy
INFO: scrcpy 1.17 &lt;https://github.com/Genymobile/scrcpy&gt;
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 0.8 MB/s (34015 bytes in 0.042s)
[server] INFO: Device: samsung SM-S908E (Android 13)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 470.161.03
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2312
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetExceptionWARN: Device disconnected

at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75)
at com.genymobile.scrcpy.ScreenEncoder.setDisplaySurface(ScreenEncoder.java:243)
at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:91)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
at com.genymobile.scrcpy.Server.main(Server.java:252)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:378)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73)
... 7 more
Caused by: java.lang.IllegalArgumentException: displayToken must not be null
at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:3693)
at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:2489)
... 9 more
WARN: Killing the server...

Para resolver foi necessário remover essa versão defasada e instalar uma versão superior a 1.18:

$ sudo apt remove scrcpy

Instale as dependências para compilar a última release do GitHub:

$ sudo apt install ffmpeg libsdl2-2.0-0 adb wget gcc git pkg-config meson ninja-build libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libusb-1.0-0 libusb-1.0-0-dev

Em seguida:

$ git clone https://github.com/Genymobile/scrcpy
$ cd scrcpy
$ ./install_release.sh

E agora instale o scrcpy:

$ ./install_release.sh

Fontes:
https://github.com/Genymobile/scrcpy/issues/2129
https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#simple



Obrigado, Fábio, por este importante complemento!

Lembrando aos leitores que se o scrcpy foi instalado via snap, deverá ser removido com 'sudo snap remove' , em vez de 'sudo apt remove'

Não conhecia este comando 'git clone'. Adorei!!

[4] Comentário enviado por pebadve085 em 17/02/2023 - 03:47h

Hello
could you guys share more information for this if possible .
https://apps.apple.com/us/app/dinar-guru-dinarguru-app/id1581089419

[5] Comentário enviado por andreuebe em 18/02/2023 - 07:21h

Hello

How could we help you?


[4] Comentário enviado por pebadve085 em 17/02/2023 - 03:47


Hello
could you guys share more information for this if possible .





Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts