onyx-intl / OnyxAndroidDemo

158 stars 41 forks source link

java.lang.ClassNotFoundException: android.onyx.utils.FontsUtils #87

Open kabukky opened 2 years ago

kabukky commented 2 years ago

The Demo runs fine for me, but in Logcat, I can see this error in several places. It seems something doesn't work out in the background and a dependency is missing:

2022-07-01 20:50:38.862 6138-6138/com.android.onyx.demo E/ReflectUtil: java.lang.ClassNotFoundException: android.onyx.utils.FontsUtils
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:453)
        at java.lang.Class.forName(Class.java:378)
        at com.onyx.android.sdk.utils.ReflectUtil.classForName(SourceFile:1)
        at com.onyx.android.sdk.device.SDMDevice.createDevice(SourceFile:262)
        at com.onyx.android.sdk.device.Device.detectDevice(SourceFile:24)
        at com.onyx.android.sdk.device.Device.<clinit>(SourceFile:2)
        at com.onyx.android.sdk.device.Device.currentDevice(SourceFile:1)
        at com.onyx.android.sdk.api.device.epd.EpdController.enablePost(SourceFile:1)
        at com.android.onyx.demo.MainActivity.onCreate(MainActivity.java:24)
        at android.app.Activity.performCreate(Activity.java:7136)
        at android.app.Activity.performCreate(Activity.java:7127)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3068)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1825)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6797)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.onyx.utils.FontsUtils" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.android.onyx.demo-DC1kf7OOLCsmlMPgx60wMg==/base.apk"],nativeLibraryDirectories=[/data/app/com.android.onyx.demo-DC1kf7OOLCsmlMPgx60wMg==/lib/arm, /data/app/com.android.onyx.demo-DC1kf7OOLCsmlMPgx60wMg==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at java.lang.Class.forName(Class.java:378) 
        at com.onyx.android.sdk.utils.ReflectUtil.classForName(SourceFile:1) 
        at com.onyx.android.sdk.device.SDMDevice.createDevice(SourceFile:262) 
        at com.onyx.android.sdk.device.Device.detectDevice(SourceFile:24) 
        at com.onyx.android.sdk.device.Device.<clinit>(SourceFile:2) 
        at com.onyx.android.sdk.device.Device.currentDevice(SourceFile:1) 
        at com.onyx.android.sdk.api.device.epd.EpdController.enablePost(SourceFile:1) 
        at com.android.onyx.demo.MainActivity.onCreate(MainActivity.java:24) 
        at android.app.Activity.performCreate(Activity.java:7136) 
        at android.app.Activity.performCreate(Activity.java:7127) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3068) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1825) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6797) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
Xie-Jason commented 2 years ago

I got the exception too, my solution is discard the sdk of onyx and rewrite these functions by myself to avoid this error. You could decompile the .class file in onyx sdk and find how the function that you need are implemented, it's easy to rewrite them if you just need a few function, because a lot of platform-based functions are just load some classes in package 'android.onyx' and invoke some methods of them by reflection.