mar3kk / threekkapps_library

MIT License
11 stars 6 forks source link

java.lang.UnsatisfiedLinkError: No implementation found #3

Closed darrinps closed 8 years ago

darrinps commented 8 years ago

Trying to use this in an Android Studio project. Here is what was done.

Created C:\GitProjects\Canvas\app\src\main\jniLibs folder. Copied libjnibitmap.so to that folder

At startup, called:

System.loadLibrary("jnibitmap");

In the class where it was to be used, I created the stub like this:

public static native void floodFill(Bitmap bitmap, int x, int y, int color, int tolerance);

In a method within that class I called this:

floodBill(myBitmap, 1, 1, 0);

That is when the Unsatisfied Link Error was thrown.

mar3kk commented 8 years ago

Why don't u just use the library as is? Just add it as a module to Your project. If You want to only use my .so files your class name should be the same as declared in jnibitmap.cpp

JNIEXPORT void JNICALL Java_com_threekkapps_library_bitmap_JniBitmap_floodFill(JNIEnv * env, jobject obj, jobject bitmap, uint32_t x, uint32_t y, uint32_t color, uint32_t tolerance) {

this means it must be in com/threekkapps/library/bitmap/JniBitmap.java

darrinps commented 8 years ago

I can try moving it to there but didn't think it was supposed to be a requirement to use a .so file. I've used them in the past and just had to drop it inside of jniLibs.

Thanks.

On Wed, Dec 30, 2015 at 3:46 AM, mar3kk notifications@github.com wrote:

Why don't u just use the library as is? Just add it as a module to Your project. If You want to only use my .so files your class name should be the same as declared in jnibitmap.cpp

JNIEXPORT void JNICALL Java_com_threekkapps_library_bitmap_JniBitmap_floodFill(JNIEnv * env, jobject obj, jobject bitmap, uint32_t x, uint32_t y, uint32_t color, uint32_t tolerance) {

this means it must be in com/threekkapps/library/bitmap/JniBitmap.java

— Reply to this email directly or view it on GitHub https://github.com/mar3kk/threekkapps_library/issues/3#issuecomment-167969530 .

mar3kk commented 8 years ago

Did You manage to make it work?

darrinps commented 8 years ago

Thanks for asking but after talking it over, changing the project's package name to match yours wasn't something everyone involved wanted to do, so we will just use the pure Java version I wrote instead. Also, we wanted to tweak it to allow for undo/redo of flood fills so that would mean saving off of the pixels that get written to a path which your compiled version doesn't support.

Appreciate the follow-up though.

On Wed, Dec 30, 2015 at 5:06 PM, mar3kk notifications@github.com wrote:

Did You manage to make it work?

— Reply to this email directly or view it on GitHub https://github.com/mar3kk/threekkapps_library/issues/3#issuecomment-168092057 .

mar3kk commented 8 years ago

Well I think You should just add my library as a module to Your project. I's fast and easy. Recent versions of Android Studio even supports C++ coding and debugging. Anyway I'm closing this issue.

BR, Marek

darrinps commented 8 years ago

Agreed it should be closed.

Maybe I'll pass the code onto you once I am done adding the ability to do the path work if you all want to add that to it and then I'll think about adding it to the project to compile. I'm kind of confused though how that would work using your class path when importing the .so precompiled files does not, but I don't do much JNI. The one time I used it before I think they must have made their package name conform to mine as they coded for us exclusively and that is why I just had to drop it into the jniLibs/armeabi directory.

On Wed, Dec 30, 2015 at 5:22 PM, mar3kk notifications@github.com wrote:

Well I think You should just add my library as a module to Your project. I's fast and easy. Recent versions of Android Studio even supports C++ coding and debugging. Anyway I'm closing this issue.

BR, Marek

— Reply to this email directly or view it on GitHub https://github.com/mar3kk/threekkapps_library/issues/3#issuecomment-168094216 .