SheenFigureLegacy icon indicating copy to clipboard operation
SheenFigureLegacy copied to clipboard

Android - No text appearing

Open shaks786 opened this issue 11 years ago • 13 comments

I've updated the SheenFigure library, and now the text doesn't seem to appear at all?

shaks786 avatar Jun 18 '13 14:06 shaks786

Sorry for the inconvenience. I intended to commit only ios related code but mistakenly committed android code as well on which I'm currently working.

Please use older version for the time being.

mta452 avatar Jun 19 '13 13:06 mta452

Just pushed a newer version with glyph cache support. Hope it solves your problems.

mta452 avatar Jul 10 '13 10:07 mta452

Sorry for late reply, now I keep getting the following error, 08-18 23:23:07.445: E/AndroidRuntime(807): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load SheenFigureJNI: findLibrary returned null

Any ideas? Been trying to figure it out for a few hours now (This is with the new Demo app you recently pushed out)

shaks786 avatar Aug 18 '13 22:08 shaks786

It is possible that jni is not being compiled. In new version, there are two projects. The First one is SheenFigure-Android which compiles native library and the second one is demo project which loads library from first project. You'll have to configure android NDK on first project.

mta452 avatar Aug 19 '13 17:08 mta452

I've set it up NDK on the first project and used the demo project to add it as a library, but it just doesn't seem to compile the native code when I run the application. The NDK setup I has is shown below: screen shot 2013-08-20 at 18 36 07

shaks786 avatar Aug 20 '13 17:08 shaks786

While compiling the project, look at console window to see if it tells any errors in the native code.

mta452 avatar Aug 20 '13 18:08 mta452

no errors in console but the console doesn't even show any of the native code compiling, like how it usually should do..

shaks786 avatar Aug 20 '13 22:08 shaks786

Maybe your NDK is not being triggered. Try changing the working directory from workspace-project to absolute path.

mta452 avatar Aug 21 '13 10:08 mta452

NDK seems to run when I just start Eclipse, but not when I build/run the app. When Eclipse starts NDK greets me with this:

/SSText.c:235:2: warning: passing argument 7 of 'SFTextShowString' from incompatible pointer type [enabled by default] jni/../../SheenFigure/SFGraphics/SFText.h:57:5: note: expected 'SFGlyphRenderFunction' but argument is of type 'void (*)(void *, SFGlyph, SFFloat, SFFloat, void *)'

shaks786 avatar Aug 22 '13 12:08 shaks786

Are you sure you are using latest files? SSText.c is only 183 lines long then how can there be an error at 235 line? Here is what I think you must do.

  1. Delete any existing projects, download a fresh copy and import it in eclipse.
  2. In eclipse, goto project menu and disable "Build Automatically".
  3. Open NDK configuration. In "Main" tab, set working directory to "SheenFigure-Android". In "Build Options" tab, enable "Allocate Console", "After a Clean" and "During manual builds".
  4. Right click on the project and hit "Build Project". Watch the console window and see the progress.

If you still encounter issues, use this prebuild native library: Just copy libs folder to SheenFigure-Android project. Now it should be loaded and you shouldn't have UnsatisfiedLinkError.

mta452 avatar Aug 22 '13 13:08 mta452

Here is the link: https://www.dropbox.com/s/dqd5xzhtlr2k0fz/SheenFigureNative.zip

mta452 avatar Aug 22 '13 14:08 mta452

YES! Finally it works, turns out I was missing step 4 (Building the project), Thanks a lot. One final (hopefully) question - does SheenFigure at the moment only support one widget per layout? I tried having multiple instances of SheenFigure TextView widget within the same layout and got some NullPointer exception. Thanks again

shaks786 avatar Aug 26 '13 01:08 shaks786

Apologies, ignore the above, I had forgot to set the font on each TextView hence the nullpointer error. Seems to work fine!

shaks786 avatar Aug 26 '13 01:08 shaks786