Skip to content

error java.lang.ClassNotFoundException: Didn't find class "org.pytorch.executorch.NativePeer" #8636

Closed
@adonnini

Description

@adonnini

Hi,

I tried to run the model produced with executorch using the executorch runtime for Android.

In /app/src/main/jniLibs/arm64-v8a for my app I have libexecutorch.so created following the instructions in
https://pytorch.org/executorch/stable/demo-apps-android.html

When I attempt to execute the following command in my application

mModule = Module.load(moduleFileAbsoluteFilePath);

execution fails producing the error log you will find below.

What am I doing wrong? What should I do next? Please let me know if you need additional information.

Thanks

ERROR LOG

02-22 14:00:59.256: I/NeuralNetworkService(26059):  - neuralNetworkloadAndRunPytorch - About to load module --- 
02-22 14:00:59.271: W/libc(26059): Access denied finding property "ro.mediatek.platform"
02-22 14:00:59.271: W/libc(26059): Access denied finding property "ro.chipname"
02-22 14:00:59.271: E/audit(1210): type=1400 audit(1740229259.269:43350): avc:  denied  { read } for  pid=26059 comm="Thread-2" name="u:object_r:media_plat_prop:s0" dev="tmpfs" ino=315 scontext=u:r:untrusted_app_30:s0:c45,c258,c512,c768 tcontext=u:object_r:media_plat_prop:s0 tclass=file permissive=0 SEPF_SM-S908B_12_0001 audit_filtered
02-22 14:00:59.273: D/nativeloader(26059): Load /data/app/~~CzYQ5jB-bXszoW-cWE7uUg==/com.android.contextq-B_Rwji2_VyK2Jx3NvUwN1A==/base.apk!/lib/arm64-v8a/libexecutorch.so using ns clns-5 from class loader (caller=/data/app/~~CzYQ5jB-bXszoW-cWE7uUg==/com.android.contextq-B_Rwji2_VyK2Jx3NvUwN1A==/base.apk): ok
02-22 14:00:59.275: E/log(26059): error java.lang.ClassNotFoundException: Didn't find class "org.pytorch.executorch.NativePeer" on path: DexPathList[[zip file "/data/app/~~CzYQ5jB-bXszoW-cWE7uUg==/com.android.contextq-B_Rwji2_VyK2Jx3NvUwN1A==/base.apk"],nativeLibraryDirectories=[/data/app/~~CzYQ5jB-bXszoW-cWE7uUg==/com.android.contextq-B_Rwji2_VyK2Jx3NvUwN1A==/lib/arm64, /data/app/~~CzYQ5jB-bXszoW-cWE7uUg==/com.android.contextq-B_Rwji2_VyK2Jx3NvUwN1A==/base.apk!/lib/arm64-v8a, /system/lib64]]
02-22 14:00:59.275: A/lNetworkService(26059): java_vm_ext.cc:616] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: Didn't find class "org.pytorch.executorch.NativePeer" on path: DexPathList[[zip file "/data/app/~~CzYQ5jB-bXszoW-cWE7uUg==/com.android.contextq-B_Rwji2_VyK2Jx3NvUwN1A==/base.apk"],nativeLibraryDirectories=[/data/app/~~CzYQ5jB-bXszoW-cWE7uUg==/com.android.contextq-B_Rwji2_VyK2Jx3NvUwN1A==/lib/arm64, /data/app/~~CzYQ5jB-bXszoW-cWE7uUg==/com.android.contextq-B_Rwji2_VyK2Jx3NvUwN1A==/base.apk!/lib/arm64-v8a, /system/lib64]]
02-22 14:00:59.275: A/lNetworkService(26059): java_vm_ext.cc:616] (Throwable with no stack trace)
02-22 14:00:59.275: A/lNetworkService(26059): java_vm_ext.cc:616] 
02-22 14:00:59.275: A/lNetworkService(26059): java_vm_ext.cc:616]     in call to NewGlobalRef
02-22 14:00:59.275: A/lNetworkService(26059): java_vm_ext.cc:616]     from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class)
02-22 14:00:59.276: E/audit(1210): type=1400 audit(1740229259.269:43351): avc:  denied  { read } for  pid=26059 comm="Thread-2" name="u:object_r:chipname_prop:s0" dev="tmpfs" ino=165 scontext=u:r:untrusted_app_30:s0:c45,c258,c512,c768 tcontext=u:object_r:chipname_prop:s0 tclass=file permissive=0 SEPF_SM-S908B_12_0001 audit_filtered

cc @kirklandsign @cbilgin @mergennachin @byjlw

Metadata

Metadata

Assignees

Labels

module: androidIssues related to Android code, build, and executionmodule: user experienceIssues related to reducing friction for users

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions