timgaddis / Planets-Position-v1

Planets Position is a program to calculate the position of the planets in the night sky.
http://planetsposition.blogspot.com/
4 stars 2 forks source link

Failed to use the libplanets_swiss #1

Closed permalmquist closed 10 years ago

permalmquist commented 10 years ago

Hello, I found your App in the Google Play. I use it and it's great. Then I saw the link to github and I try to learn to make my own App for calculate and record distances and I found that your library has most of the parts I need :) so I downloaded the master package. However, the call to utc2jd (e.g. in the file Position.java) does'nt work (for me), There is no entry for this method, according to LogCat. I have compiled and linked the libplanets_swiss with Android NDK and the library is loaded according to the report in LogCat. There is a prototype "public native double[] utc2jd(int m, ....)" and in planets_swiss.c, there is the method "Java_planets_position_SolarEclipse_utc2jd(JNIEnv* env,.....)". How does these communicate ? Am I supposed to code the interface myself or is there a missing file in your package ? Regards Per Malmquist

timgaddis commented 10 years ago

You don't need to code an interface, the prototype just tells Android that the method is in the libplanets_swiss library.

permalmquist commented 10 years ago

Hello Again,

I executed the ndk-build and the only thing I defined was NDK_PROJECT_PATH as the path to the project Planets.

NDK_PROJECT_PATH=C:\Per\app_dev\adt-bundle-windows-x86_64-20140321\workspace\Planets

As a result, the libplanet_swiss.so was copied to the folder lib/armeabi and this seems OK to me, but I recieved FATAL EXCEPTION: main when I push "Sky Position" and select a planet.

In the folowing log (LogCat), the problem starts at

(36.788) Failure getting entry for 0x010802c0 (t=7 e=704) in package 0 (error -75)

According to the line (43.578), the library seems o be loaded (but I don't understand the path "/data/data/com.example.planets/lib/libplanets_swiss.so")

At line (43.618) the utc2jd is not found.

Do I have to define something in the Eclipce ?

Any Idea ?

06-30 21:11:09.398: I/Process(9030): Sending signal. PID: 9030 SIG: 9 06-30 21:11:28.373: I/ActivityThread(9172): Pub com.example.planets.planetsdbprovider: com.example.planets.PlanetsDbProvider 06-30 21:11:28.653: D/libEGL(9172): loaded /system/lib/egl/libEGL_mali.so 06-30 21:11:28.653: D/libEGL(9172): loaded /system/lib/egl/libGLESv1_CM_mali.so 06-30 21:11:28.658: D/libEGL(9172): loaded /system/lib/egl/libGLESv2_mali.so 06-30 21:11:28.658: D/(9172): Device driver API match 06-30 21:11:28.658: D/(9172): Device driver API version: 10 06-30 21:11:28.658: D/(9172): User space API version: 10 06-30 21:11:28.658: D/(9172): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Thu Oct 25 08:43:05 KST 2012 06-30 21:11:28.678: D/OpenGLRenderer(9172): Enabling debug mode 0 06-30 21:11:36.653: D/AbsListView(9172): Get MotionRecognitionManager 06-30 21:11:36.773: D/dalvikvm(9172): GC_CONCURRENT freed 143K, 13% free 9726K/11143K, paused 14ms+23ms, total 116ms 06-30 21:11:36.773: W/CursorWrapperInner(9172): Cursor finalized without prior close() 06-30 21:11:36.778: W/CursorWrapperInner(9172): Cursor finalized without prior close() 06-30 21:11:36.778: W/CursorWrapperInner(9172): Cursor finalized without prior close() 06-30 21:11:36.783: D/dalvikvm(9172): WAIT_FOR_CONCURRENT_GC blocked 16ms 06-30 21:11:36.788: W/ResourceType(9172): Failure getting entry for 0x010802c0 (t=7 e=704) in package 0 (error -75) 06-30 21:11:43.573: D/dalvikvm(9172): Trying to load lib /data/data/com.example.planets/lib/libplanets_swiss.so 0x420bf238 06-30 21:11:43.578: D/dalvikvm(9172): Added shared lib /data/data/com.example.planets/lib/libplanets_swiss.so 0x420bf238 06-30 21:11:43.618: W/dalvikvm(9172): No implementation found for native Lcom/example/planets/Position;.utc2jd:(IIIIID)[D 06-30 21:11:43.623: D/AndroidRuntime(9172): Shutting down VM 06-30 21:11:43.623: W/dalvikvm(9172): threadid=1: thread exiting with uncaught exception (group=0x4165a2a0) 06-30 21:11:43.628: E/AndroidRuntime(9172): FATAL EXCEPTION: main 06-30 21:11:43.628: E/AndroidRuntime(9172): java.lang.UnsatisfiedLinkError: Native method not found: com.example.planets.Position.utc2jd:(IIIIID)[D 06-30 21:11:43.628: E/AndroidRuntime(9172): at com.example.planets.Position.utc2jd(Native Method) 06-30 21:11:43.628: E/AndroidRuntime(9172): at com.example.planets.Position.computeLocation(Position.java:158) 06-30 21:11:43.628: E/AndroidRuntime(9172): at com.example.planets.Position.updateDisplay(Position.java:248) 06-30 21:11:43.628: E/AndroidRuntime(9172): at com.example.planets.Position.onCreate(Position.java:113) 06-30 21:11:43.628: E/AndroidRuntime(9172): at android.app.Activity.performCreate(Activity.java:5206) 06-30 21:11:43.628: E/AndroidRuntime(9172): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 06-30 21:11:43.628: E/AndroidRuntime(9172): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074) 06-30 21:11:43.628: E/AndroidRuntime(9172): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 06-30 21:11:43.628: E/AndroidRuntime(9172): at android.app.ActivityThread.access$700(ActivityThread.java:140) 06-30 21:11:43.628: E/AndroidRuntime(9172): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) 06-30 21:11:43.628: E/AndroidRuntime(9172): at android.os.Handler.dispatchMessage(Handler.java:99) 06-30 21:11:43.628: E/AndroidRuntime(9172): at android.os.Looper.loop(Looper.java:137) 06-30 21:11:43.628: E/AndroidRuntime(9172): at android.app.ActivityThread.main(ActivityThread.java:4921) 06-30 21:11:43.628: E/AndroidRuntime(9172): at java.lang.reflect.Method.invokeNative(Native Method) 06-30 21:11:43.628: E/AndroidRuntime(9172): at java.lang.reflect.Method.invoke(Method.java:511) 06-30 21:11:43.628: E/AndroidRuntime(9172): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) 06-30 21:11:43.628: E/AndroidRuntime(9172): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) 06-30 21:11:43.628: E/AndroidRuntime(9172): at dalvik.system.NativeStart.main(Native Method)

/Per

On 2014-06-30 16:39, timgaddis wrote:

You don't need to code an interface, the prototype just tells Android that the method is in the libplanets_swiss library.

— Reply to this email directly or view it on GitHub https://github.com/timgaddis/Planets-Position/issues/1#issuecomment-47539447.


Detta epostmeddelande innehåller inget virus eller annan skadlig kod för avast! antivirus är aktivt. http://www.avast.com

timgaddis commented 10 years ago

The package names in your project need to be renamed to planets.position and planets.position.data.

permalmquist commented 10 years ago

Hello again, the problem is solved. I decided to solve it in a slightly different way: I kept my package name and instead changed the reference in libplanets_swiss.c to

Java_com_example_planets_Position_utc2jd

and all other references here.

Now the app works !

Thank you for your help, it was your hint that helped me and as a bonus, I now understand how the references in libplanets_swiss works :)

Regards Per

On 2014-07-01 17:57, timgaddis wrote:

The package names in your project need to be renamed to planets.position and planets.position.data.

— Reply to this email directly or view it on GitHub https://github.com/timgaddis/Planets-Position/issues/1#issuecomment-47674563.


Detta epostmeddelande innehåller inget virus eller annan skadlig kod för avast! antivirus är aktivt. http://www.avast.com