Closed gantulgana93 closed 3 years ago
My project always worked well with @flyskywhy/react-native-gcanvas@2.0.0, do you use 2.0.0?
Can you provide an example code for me to compile? Or please tell me your compile environment e.g. react-native version.
Same issue here.I am using @flyskywhy/react-native-gcanvas@2.0.0 as well
Upon further investigation, I found this breaking update: https://developer.android.com/studio/releases/gradle-plugin#cmake-imported-targets. Therefore, anyone with version 4.0.0
or above should face this issue, such as below.
build.gradle
dependencies {
classpath('com.android.tools.build:gradle:4.1.1')
...
}
After I had downgraded to com.android.tools.build:gradle:3.6.4
, I can finally build without a problem. However, new problem raises, giving below error:
2021-01-22 19:02:46.276 9089-9089/com.mysgfestivalpost E/CANVAS: gcanvas is not found.dlopen failed: library "libfreetype.so" not found
2021-01-22 19:02:46.276 9089-9089/com.mysgfestivalpost I/CANVAS: GCanvasJNI init end----
2021-01-22 19:02:46.277 9089-9089/com.mysgfestivalpost E/ysgfestivalpos: No implementation found for void com.taobao.gcanvas.GCanvasJNI.setContextType(java.lang.String, int) (tried Java_com_taobao_gcanvas_GCanvasJNI_setContextType and Java_com_taobao_gcanvas_GCanvasJNI_setContextType__Ljava_lang_String_2I)
2021-01-22 19:02:46.277 9089-9089/com.mysgfestivalpost D/AndroidRuntime: Shutting down VM
2021-01-22 19:02:46.279 9089-9089/com.mysgfestivalpost E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mysgfestivalpost, PID: 9089
java.lang.UnsatisfiedLinkError: No implementation found for void com.taobao.gcanvas.GCanvasJNI.setContextType(java.lang.String, int) (tried Java_com_taobao_gcanvas_GCanvasJNI_setContextType and Java_com_taobao_gcanvas_GCanvasJNI_setContextType__Ljava_lang_String_2I)
at com.taobao.gcanvas.GCanvasJNI.setContextType(Native Method)
at com.taobao.gcanvas.GCanvasJNI.setWrapperContextType(GCanvasJNI.java:263)
at com.taobao.gcanvas.surface.GTextureViewCallback.<init>(GTextureViewCallback.java:49)
at com.taobao.gcanvas.surface.GTextureView.init(GTextureView.java:70)
at com.taobao.gcanvas.surface.GTextureView.<init>(GTextureView.java:21)
at com.taobao.gcanvas.bridges.rn.GReactTextureView.<init>(GReactTextureView.java:27)
at com.taobao.gcanvas.bridges.rn.GReactViewManager.createViewInstance(GReactViewManager.java:28)
at com.taobao.gcanvas.bridges.rn.GReactViewManager.createViewInstance(GReactViewManager.java:18)
at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:139)
at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:83)
at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:261)
at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:186)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1112)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1083)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:727)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:907)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7478)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
@gaara4896 , please try
jniLibs.srcDirs '../../core/android/freetype-prebuilt/libs'
in node_modules/@flyskywhy/react-native-gcanvas/android/gcanvas_library/build.gradle
ref to https://developer.android.com/studio/releases/gradle-plugin#cmake-imported-targets ?Got same issue. Any ideas?
--------- beginning of crash 2021-04-02 22:09:34.443 26512-26512/com.testgcanvas E/AndroidRuntime: FATAL EXCEPTION: main Process: com.testgcanvas, PID: 26512 java.lang.UnsatisfiedLinkError: No implementation found for void com.taobao.gcanvas.GCanvasJNI.setContextType(java.lang.String, int) (tried Java_com_taobao_gcanvas_GCanvasJNI_setContextType and Java_com_taobao_gcanvas_GCanvasJNI_setContextType__Ljava_lang_String_2I) at com.taobao.gcanvas.GCanvasJNI.setContextType(Native Method) at com.taobao.gcanvas.GCanvasJNI.setWrapperContextType(GCanvasJNI.java:263) at com.taobao.gcanvas.surface.GTextureViewCallback.<init>(GTextureViewCallback.java:49) at com.taobao.gcanvas.surface.GTextureView.init(GTextureView.java:70) at com.taobao.gcanvas.surface.GTextureView.<init>(GTextureView.java:21) at com.taobao.gcanvas.bridges.rn.GReactTextureView.<init>(GReactTextureView.java:27) at com.taobao.gcanvas.bridges.rn.GReactViewManager.createViewInstance(GReactViewManager.java:28) at com.taobao.gcanvas.bridges.rn.GReactViewManager.createViewInstance(GReactViewManager.java:18) at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:139) at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:83) at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281) at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:188) at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:902) at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1019) at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1079) at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29) at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175) at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:947) at android.view.Choreographer.doCallbacks(Choreographer.java:761) at android.view.Choreographer.doFrame(Choreographer.java:693) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) 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)
Figured this out. App was only crashing on Emulator running on x86 MacMini. Following warning clearly states this:
ABIs [x86,armeabi-v7a,armeabi] set by 'android.injected.build.abi' gradle flag contained 'ARMEABI, X86' not targeted by this project.
@
@ gaara4896,请尝试
- 使用我很好用的gradle-6.2; 或者
- 除去
jniLibs.srcDirs '../../core/android/freetype-prebuilt/libs'
在node_modules/@flyskywhy/react-native-gcanvas/android/gcanvas_library/build.gradle
裁判 https://developer.android.com/studio/releases/gradle-plugin#cmake-imported-targets?
不能在x86的模拟器上运行么
@liuhuapiaoyuan ,那些号称运行速度飞快的模拟器其实是模拟了 x86 平台)上运行的。而原始阿里官方的 GCanvas 的 react-native 版本就只支持 "armeabi-v7a" 和 "arm64-v8a" 这两个 ABI 的,所以请直接在手机上运行看看?
v6.0.13 support x86 (Android emulator) now
On android it gives following error.
More than one file was found with OS independent path 'lib/armeabi-v7a/libfreetype.so'
Anyone knows how to resolve it?