siwangqishiq / ImageEditor-Android

AndroidImageEdit 安卓设备上图形编辑开源控件,支持磨皮美白 自定义贴图 图片滤镜 图片旋转 图片剪裁 文字贴图 撤销 回退 等操作
2.19k stars 567 forks source link

Filters Isuue #98

Closed brittle123 closed 3 years ago

brittle123 commented 3 years ago

Hello Sir !,.. I'm getting this error when clicking on any filter option. Please help me to resolve it ASAP! Regards & Thanks.

Caused by: java.lang.UnsatisfiedLinkError: No implementation found for int com.virtoxed.imageeditlibrary.editimage.fliter.PhotoProcessing.nativeInitBitmap(int, int) (tried Java_com_virtoxed_imageeditlibrary_editimage_fliter_PhotoProcessing_nativeInitBitmap and Java_com_virtoxed_imageeditlibrary_editimage_fliter_PhotoProcessing_nativeInitBitmap__II) at com.virtoxed.imageeditlibrary.editimage.fliter.PhotoProcessing.nativeInitBitmap(Native Method) at com.virtoxed.imageeditlibrary.editimage.fliter.PhotoProcessing.sendBitmapToNative(PhotoProcessing.java:138) at com.virtoxed.imageeditlibrary.editimage.fliter.PhotoProcessing.filterPhoto(PhotoProcessing.java:21) at com.virtoxed.imageeditlibrary.editimage.fragment.FilterListFragment$ProcessingImage.doInBackground(FilterListFragment.java:186) at com.virtoxed.imageeditlibrary.editimage.fragment.FilterListFragment$ProcessingImage.doInBackground(FilterListFragment.java:173) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)  at java.lang.Thread.run(Thread.java:764) 

siwangqishiq commented 3 years ago

I see you change package name to "com.virtoxed.imageeditlibrary.editimage.fliter.PhotoProcessing.nativeInitBitmap"
fliter implements with jni shoud find my pachage "com.xinlan.imageedit..." (C/C++ method name) so you can not change this package (for filter method)

brittle123 commented 3 years ago

Sir how can i fix it then? i've to change its package name naa when i've to use it for my own.

siwangqishiq commented 3 years ago

Two solution

  1. recompile to make new .so file with ndk change imageeditlibrary/jni/photo_processing.c replace "com.xinlan." => your package name ;
  2. only copy file PhotoProcessing.java (no change package!!) to your project, Use PhotoProcessing.java when you need fliter.
brittle123 commented 3 years ago

And at the end it's also showing the toast of save error. I think this is also because of change package name! Isn't it?

siwangqishiq commented 3 years ago

And at the end it's also showing the toast of save error. I think this is also because of change package name! Isn't it?

This question has nothing to do with package name

brittle123 commented 3 years ago

Sir i've used your 2nd option in which i only used your PhotoProcessing.java file, when i'm clicking on filter option now i'm getting this error.

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2 Process: com.virtoxed.bgeraser, PID: 28880 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.virtoxed.bgeraser-2/base.apk"],nativeLibraryDirectories=[/data/app/com.virtoxed.bgeraser-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libphotoprocessing.so" at java.lang.Runtime.loadLibrary(Runtime.java:367) at java.lang.System.loadLibrary(System.java:1076) at com.virtoxed.bgeraser.editor.editimage.filter.PhotoProcessing.(PhotoProcessing.java:64) at com.virtoxed.bgeraser.editor.editimage.fragment.FilterListFragment$ProcessingImage.doInBackground(FilterListFragment.java:181) at com.virtoxed.bgeraser.editor.editimage.fragment.FilterListFragment$ProcessingImage.doInBackground(FilterListFragment.java:168) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:818)  E/WindowManager: android.view.WindowLeaked: Activity com.virtoxed.bgeraser.editor.editimage.EditImageActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{bb07ce4 V.E...... R......D 0,0-1026,348} that was originally added here at android.view.ViewRootImpl.(ViewRootImpl.java:397) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85) at android.app.Dialog.show(Dialog.java:319) at com.virtoxed.bgeraser.editor.editimage.fragment.FilterListFragment$ProcessingImage.onPreExecute(FilterListFragment.java:216) at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:604) at android.os.AsyncTask.execute(AsyncTask.java:551) at com.virtoxed.bgeraser.editor.editimage.fragment.FilterListFragment$FliterClick.onClick(FilterListFragment.java:159) at android.view.View.performClick(View.java:5226) at android.view.View$PerformClick.run(View.java:21266) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:168) at android.app.ActivityThread.main(ActivityThread.java:5845) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)

siwangqishiq commented 3 years ago

Did you copy "jniLibs/ " so file to your project?

brittle123 commented 3 years ago

Are you asking me about these files? jni

brittle123 commented 3 years ago

i've added your jni folder to my project but it's not working for me.

siwangqishiq commented 3 years ago

jniLibs/photoprocessing.so file

smfahadhassan commented 3 years ago

Two solution

  1. recompile to make new _.so file with ndk change imageeditlibrary/jni/photoprocessing.c replace "com.xinlan." => your package name ;
  2. only copy file PhotoProcessing.java (no change package!!) to your project, Use PhotoProcessing.java when you need fliter.

@siwangqishiq I am quite new in android .. can you please explain the solution 1 that you suggested in detail ? my questions are: 1)where can I find the ndk? and what to change in it? 2)what to change in this file "imageeditlibrary/jni/photo_processing.c" ? 3)and at the end you asked to change the package name, is it in the build.gradle or somewhere else also?

siwangqishiq commented 3 years ago

Two solution

  1. recompile to make new _.so file with ndk change imageeditlibrary/jni/photoprocessing.c replace "com.xinlan." => your package name ;
  2. only copy file PhotoProcessing.java (no change package!!) to your project, Use PhotoProcessing.java when you need fliter.

@siwangqishiq I am quite new in android .. can you please explain the solution 1 that you suggested in detail ? my questions are: 1)where can I find the ndk? and what to change in it? 2)what to change in this file "imageeditlibrary/jni/photo_processing.c" ? 3)and at the end you asked to change the package name, is it in the build.gradle or somewhere else also?

1) https://developer.android.com/ndk/guides#download-ndk command "ndk-build " in your project 2) imageeditlibrary/jni/photo_processing.c change C function name "java_com_xinlan_xxx " => "java_com_yourpackage_xxx" 3) no need

brittle123 commented 3 years ago

Sir i've tried everything but can't add jni libs correctly,.. please can you show me your build.gradle file in which you've added your ndk and jni path.

brittle123 commented 3 years ago

--->I downloaded your project. --->Changed package name of demo module from com.xinlan.bgeraser to com.virtoxed.backgrounderaser which automatically changed the package name of imageditlibrary module from com.xinlan.imageeditlibrary to com.virtoxed.imageeditlibrary. --->Changed package of your photo_processing.c functions from Java_com_xinlan_imageeditlibrary_editimage... to Java_com_virtoxed_imageeditlibrary_editimage... --->Exactly don't know from where to add armeabi files in your jniLibs folder but i added these files from this path "imageeditlibrary\build\intermediates\library_jni\debug\jni"

And after that it still giving me the error of unsatisfiedlink

siwangqishiq commented 3 years ago

Where are you from?

------------------ 原始邮件 ------------------ 发件人: "siwangqishiq/ImageEditor-Android" @.>; 发送时间: 2021年6月24日(星期四) 下午4:39 @.>; @.>;"State @.>; 主题: Re: [siwangqishiq/ImageEditor-Android] Filters Isuue (#98)

Sir please help me to solve this issue,.. it's really important for me. If you can add these files correctly for me i'll send my project to you.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

brittle123 commented 3 years ago

Fom Pakistan Sir.

siwangqishiq commented 3 years ago

Are you compile c/c++ code in jni (using ndk)?

------------------ 原始邮件 ------------------ 发件人: "siwangqishiq/ImageEditor-Android" @.>; 发送时间: 2021年6月24日(星期四) 下午5:01 @.>; @.>;"State @.>; 主题: Re: [siwangqishiq/ImageEditor-Android] Filters Isuue (#98)

Fom Pakistan Sir.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

brittle123 commented 3 years ago

yes, 1)I have downloaded the ndk, configured it with jni/android.mk .. 2) changed the function names from "com.xinlan." to "com.virtoxed" in photo_processing.c as you said .. 3) than I Build that project with that new ndk change, .so files are generated in these directories: "imageeditlibrary/build/intermediates/library_jni", "imageeditlibrary/build/intermediates/merged_native_libs", "imageeditlibrary/build/intermediates/merged_jni_libs", "imageeditlibrary/build/intermediates/ndkBuild" 4) tried all these .so files one by one by copying them in jniLibs directroy in "imageeditlibrary/main/src/jniLibs", synced and rebuild the project ..

still not working and throwing the UnsatisfiedLink Error ...

siwangqishiq commented 3 years ago

can you run command "ndk-build " to generator new so file? 

------------------ 原始邮件 ------------------ 发件人: "siwangqishiq/ImageEditor-Android" @.>; 发送时间: 2021年6月24日(星期四) 下午5:13 @.>; @.>;"State @.>; 主题: Re: [siwangqishiq/ImageEditor-Android] Filters Isuue (#98)

yes, 1)I have downloaded the ndk, configured it with jni/android.mk .. 2) changed the function names from "com.xinlan." to "com.virtoxed" in photo_processing.c as you said .. 3) than I Build that project with that new ndk change, .so files are generated in these directories: "imageeditlibrary/build/intermediates/library_jni", "imageeditlibrary/build/intermediates/merged_native_libs", "imageeditlibrary/build/intermediates/merged_jni_libs", "imageeditlibrary/build/intermediates/ndkBuild" 4) tried all these .so files one by one by copying them in jniLibs directroy in "imageeditlibrary/main/src/jniLibs", synced and rebuild the project ..

still not working and throwing the UnsatisfiedLink Error ...

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

brittle123 commented 3 years ago

solved,.. Thanks.