Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
109.42k stars 10.52k forks source link

Android 12: Server connection failed | ART APEX data files are untrusted #3467

Open fwiep opened 2 years ago

fwiep commented 2 years ago

Environment

Bug description Ever since my custom ROM got updated to Android 12.1 (LineageOS 19.1), scrcpy no longer works - at all. Using a manual build from master with prebuilt server, I receive the following console and adb output (I have redacted the device's serial number).

Console output:

$ scrcpy  -Vdebug
scrcpy 1.24 <https://github.com/Genymobile/scrcpy>
DEBUG: ADB device found:
DEBUG:     -->   (usb)  ZY32******                      device  moto_g_6_
DEBUG: Device serial: ZY32******
DEBUG: Using server: /usr/local/share/scrcpy/scrcpy-server
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 184.7 MB/s (41159 bytes in 0.000s)
DEBUG: Interrupting socket
DEBUG: Server disconnected
DEBUG: Server terminated
ERROR: Server connection failed

adb logcat output:

08-24 15:13:43.962 16254 16254 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
08-24 15:13:43.990 16254 16254 I AndroidRuntime: Using default boot image
08-24 15:13:43.990 16254 16254 I AndroidRuntime: Leaving lock profiling enabled
08-24 15:13:44.006 16254 16254 W app_process: ART APEX data files are untrusted.
08-24 15:13:44.007 16254 16254 E app_process: Could not open boot oat file for extracting boot class path: File /apex/com.android.art/javalib/boot.art:/system/framework/boot-framework.art!/system/etc/arm64/boot-image.vdex does not exist.
08-24 15:13:44.007 16254 16254 E AndroidRuntime: JNI_CreateJavaVM failed

I build the custom ROM myself, so any simple change on that side should be possible.

How can I help fix this issue?

Thanks, FWieP

RDPCoder commented 1 year ago

Hi, I have the same problem as you, did you solve it?

fwiep commented 1 year ago

Hi, I have the same problem as you, did you solve it?

Unfortunately, no. There has been no progress in solving this specific issue.

I have no leads to investigate. Any help would be welcome.

Kind regards, FWieP

RDPCoder commented 1 year ago

你好,我遇到了和你一样的问题,请问你解决了吗?

抱歉不行。 在解决这个具体问题方面没有取得任何进展。

我没有线索可以调查。欢迎任何帮助。

亲切的问候, FWieP

I'm working on this issue, it should be configuration cause, we can add telegram,

fwiep commented 1 year ago

Using the new scrcpy 2.0 from master and pre-built server under Fedora 37, the problem still exists. I cannot use my Android 12 device using scrcpy. ADB itself is working fine, but I still receive the same errors from both scrcpy:

scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
WARN: Could not disable minimize on focus loss
DEBUG: ADB device found:
DEBUG:     -->   (usb)  ZY32******                      device  moto_g_6_
DEBUG: Device serial: ZY32******
DEBUG: Using server: /usr/local/share/scrcpy/scrcpy-server
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 250.2 MB/s (52867 bytes in 0.000s)
DEBUG: Interrupting socket
DEBUG: Server disconnected
DEBUG: Server terminated
ERROR: Server connection failed

as in Android's logcat:

03-12 11:06:42.469 23204 23204 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
03-12 11:06:42.499 23204 23204 I AndroidRuntime: Using default boot image
03-12 11:06:42.499 23204 23204 I AndroidRuntime: Leaving lock profiling enabled
03-12 11:06:42.512 23204 23204 W app_process: ART APEX data files are untrusted.
03-12 11:06:42.513 23204 23204 E app_process: Could not open boot oat file for extracting boot class path: File /apex/com.android.art/javalib/boot.art:/system/framework/boot-framework.art!/system/etc/arm64/boot-image.vdex does not exist.
03-12 11:06:42.513 23204 23204 E AndroidRuntime: JNI_CreateJavaVM failed

Can someone shed some light on this issue? @RDPCoder did you resolve your case, and if so, how?

Thanks, FWieP

fwiep commented 1 year ago

Using the new scrcpy 2.1 from master and pre-built server under Fedora 38, the problem still exists. I cannot use my Android 12 device using scrcpy. ADB itself is working fine, but I still receive the same errors.

scrcpy 2.1 <https://github.com/Genymobile/scrcpy>
WARN: Could not disable minimize on focus loss
DEBUG: ADB device found:
DEBUG:     -->   (usb)  ZY3xxxxxxx                      device  moto_g_6_
DEBUG: Device serial: ZY3xxxxxxx
DEBUG: Using server: /usr/local/share/scrcpy/scrcpy-server
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 272.7 MB/s (52867 bytes in 0.000s)
DEBUG: Interrupting socket
DEBUG: Server disconnected
DEBUG: Server terminated
ERROR: Server connection failed
06-22 11:05:01.584 17679 17679 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
06-22 11:05:01.596 17679 17679 I AndroidRuntime: Using default boot image
06-22 11:05:01.596 17679 17679 I AndroidRuntime: Leaving lock profiling enabled
06-22 11:05:01.604 17679 17679 W app_process: ART APEX data files are untrusted.
06-22 11:05:01.604 17679 17679 E app_process: Could not open boot oat file for extracting boot class path: File /apex/com.android.art/javalib/boot.art:/system/framework/boot-framework.art!/system/etc/arm64/boot-image.vdex does not exist.
06-22 11:05:01.604 17679 17679 E AndroidRuntime: JNI_CreateJavaVM failed

Is there something I can do to further debug or perhaps even solve this issue? @RDPCoder, are you still having this same issue? If not how did you solve it?

Thanks, FWieP

rom1v commented 1 year ago

Could you try with a minimal sample (an hello world) to execute a .jar with app_process?

https://blog.rom1v.com/2018/03/introducing-scrcpy/#run-a-java-main-on-android

fwiep commented 1 year ago

Sadly, nothing happens when I compile the .java file, push via adb and execute the classes.dex. I receive no output at all. But no visible error message, either.

In the adb logcat, I get the same error as when calling scrcpy:

06-22 15:27:07.469 28062 28062 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
06-22 15:27:07.497 28062 28062 I AndroidRuntime: Using default boot image
06-22 15:27:07.498 28062 28062 I AndroidRuntime: Leaving lock profiling enabled
06-22 15:27:07.513 28062 28062 W app_process: ART APEX data files are untrusted.
06-22 15:27:07.514 28062 28062 E app_process: Could not open boot oat file for extracting boot class path: File /apex/com.android.art/javalib/boot.art:/system/framework/boot-framework.art!/system/etc/arm64/boot-image.vdex does not exist.
06-22 15:27:07.514 28062 28062 E AndroidRuntime: JNI_CreateJavaVM failed

How should I proceed? Is there something on the custom ROM side I could check or change?

Thanks, FWieP

fwiep commented 8 months ago

Using scrcpy 2.3.1 from master with self-built server under Fedora 39, the issue is still there.

This is the console output:

scrcpy 2.3.1 <https://github.com/Genymobile/scrcpy>
WARN: Could not disable minimize on focus loss
INFO: ADB device found:
INFO:     -->   (usb)  ZYxxxxxxxx                      device  moto_g_6_
DEBUG: Device serial: ZYxxxxxxxx
DEBUG: Using server: /usr/local/share/scrcpy/scrcpy-server
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 326.2 MB/s (64363 bytes in 0.000s)
DEBUG: Interrupting socket
DEBUG: Server disconnected
DEBUG: Server terminated
ERROR: Server connection failed

And Android 12's logcat:

01-05 15:47:10.341  9641  9641 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
01-05 15:47:10.352  9641  9641 I AndroidRuntime: Using default boot image
01-05 15:47:10.352  9641  9641 I AndroidRuntime: Leaving lock profiling enabled
01-05 15:47:10.359  9641  9641 W app_process: ART APEX data files are untrusted.
01-05 15:47:10.359  9641  9641 E app_process: Could not open boot oat file for extracting boot class path: File /apex/com.android.art/javalib/boot.art:/system/framework/boot-framework.art!/system/etc/arm64/boot-image.vdex does not exist.
01-05 15:47:10.360  9641  9641 E AndroidRuntime: JNI_CreateJavaVM failed

My attention was drawn back to this issue by a comment on fakemanoan/LineageOS-Releases, stating that the issue will be solved upon next LineageOS 20 build. But how does that affect my case with Android 12 (LineageOS 19)?

Can someone please shed some light on this?

Thanks, FWieP

000yesnt commented 4 days ago

@fwiep I managed to get the standalone scrcpy-server (https://github.com/Genymobile/scrcpy/blob/master/doc/develop.md#standalone-server) to output something that looks useful by starting it with a custom BOOTCLASSPATH (https://github.com/waydroid/waydroid/issues/793 with :/apex/com.android.i18n/javalib/core-icu4j.jar appended). I unfortunately can't connect to the TCP stream on VLC, so something else may be broken.

My phone (Moto G6 ali) is running your LineageOS 19.1 build, freshly installed.

scrcpy-server output:

D:\_Data\Downloads\Executables\scrcpy-win64-v2.7>adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar BOOTCLASSPATH=/apex/com.android.art/javalib/core-oj.jar:/apex/com.android.art/javalib/core-libart.jar:/apex/com.android.art/javalib/core-icu4j.jar:/apex/com.android.art/javalib/okhttp.jar:/apex/com.android.art/javalib/bouncycastle.jar:/apex/com.android.art/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/framework-atb-backward-compatibility.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar:/apex/com.android.mediaprovider/javalib/framework-mediaprovider.jar:/apex/com.android.os.statsd/javalib/framework-statsd.jar:/apex/com.android.permission/javalib/framework-permission.jar:/apex/com.android.sdkext/javalib/framework-sdkextensions.jar:/apex/com.android.wifi/javalib/framework-wifi.jar:/apex/com.android.tethering/javalib/framework-tethering.jar:/apex/com.android.i18n/javalib/core-icu4j.jar app_process / com.genymobile.scrcpy.Server 2.7 tunnel_forward=true audio=false control=false cleanup=false raw_stream=true max_size=1920 log_level=verbose
[server] INFO: Device: [motorola] motorola moto g(6) (Android 12)
[server] DEBUG: Could not get system context: null

logcat:

--------- beginning of kernel
09-20 19:31:58.701     0     0 I [ 2782.760678,5] logd: logdr: UID=0 GID=0 PID=6042 b tail=0 logMask=99 pid=0 start=0ns deadline=0ns
--------- beginning of main
09-20 19:31:59.681  6047  6047 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
09-20 19:31:59.691  6047  6047 I AndroidRuntime: Using default boot image
09-20 19:31:59.691  6047  6047 I AndroidRuntime: Leaving lock profiling enabled
09-20 19:31:59.699  6047  6047 W app_process: ART APEX data files are untrusted.
09-20 19:31:59.699  6047  6047 I app_process: Core platform API reporting enabled, enforcing=false
09-20 19:31:59.709  6047  6047 E app_process: Could not create image space with image file '/apex/com.android.art/javalib/boot.art:/system/framework/boot-framework.art!/system/etc/boot-image.prof'. Attempting to fall back to imageless running. Error was: Failed to open '/apex/com.android.art/javalib/arm64/boot-core-icu4j.art'
09-20 19:31:59.815  6047  6047 W app_process: Skipping non-existent dex file '/apex/com.android.art/javalib/core-icu4j.jar'
09-20 19:32:00.518  6047  6047 W app_process: Skipping non-existent dex file '/system/framework/framework-atb-backward-compatibility.jar'
09-20 19:32:00.692  6047  6047 D app_process: Time zone APEX ICU file found: /apex/com.android.tzdata/etc/icu/icu_tzdata.dat
09-20 19:32:00.693  6047  6047 D app_process: I18n APEX ICU file found: /apex/com.android.i18n/etc/icu/icudt68l.dat
09-20 19:32:01.493  6047  6047 D ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument
09-20 19:32:01.494  6047  6047 D AndroidRuntime: Calling main entry com.genymobile.scrcpy.Server
09-20 19:32:01.495     0     0 I [ 2785.555206,4] binder: 6047:6047 ioctl 40046210 7fc7e45be4 returned -22
09-20 19:32:01.504  6047  6047 I scrcpy  : Device: [motorola] motorola moto g(6) (Android 12)
09-20 19:32:01.604  1275  1275 W Binder:1275_9: type=1400 audit(0.0:646): avc: denied { getattr } for uid=1000 scontext=u:r:system_server:s0 tcontext=u:r:su:s0 tclass=process permissive=0
09-20 19:32:01.604  1275  1275 W Binder:1275_9: type=1400 audit(0.0:647): avc: denied { getattr } for uid=1000 scontext=u:r:system_server:s0 tcontext=u:r:su:s0 tclass=process permissive=0
09-20 19:32:01.641  1275  1275 W Binder:1275_9: type=1400 audit(0.0:648): avc: denied { getattr } for uid=1000 scontext=u:r:system_server:s0 tcontext=u:r:su:s0 tclass=process permissive=0
09-20 19:32:01.644  1275  1275 W Binder:1275_9: type=1400 audit(0.0:649): avc: denied { getattr } for uid=1000 scontext=u:r:system_server:s0 tcontext=u:r:su:s0 tclass=process permissive=0
09-20 19:32:01.985  6047  6047 W app_process: Landroid/app/SystemServiceRegistry; failed initialization: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
09-20 19:32:01.985  6047  6047 W app_process: (Throwable with no stack trace)
09-20 19:32:01.986  6047  6047 D scrcpy  : Could not get system context: null
09-20 19:32:02.681  2275  2309 W rkstack.proces: Reducing the number of considered missed Gc histogram windows from 275 to 100
fwiep commented 1 day ago

@000yesnt thank you for diving into this.

To be honest, I have no idea where to look or what to do to investigate or even fix this issue. Furthermore, the Moto G6 is no longer my primary device; for me, it is now just a backup phone. With the latest LineageOS 19.1, it works for my basic usage (calling, being called, wifi, camera).

If you do find out how to fix this, please share the info. I will gladly put it up on XDA.

Thanks, FWieP

rom1v commented 1 day ago

It seems it is fixed in LineageOS (IIUC): https://github.com/fakemanoan/LineageOS-Releases/issues/23