Office Hours — Today, November 12

Tuesday, November 10

Mark M.
has entered the room
Mark M.
turned on guest access
Matt
has entered the room
Mark M.
hello, Matt!
how can I help you today?
Matt
View paste
Hi Mark
Hope things are good.
I'm trying to integrate a .so library into my app.
View paste
I have been given the .so file precompiled in the following folder structure.

nativelibs -> arm64 -> libmylibrary.so
	  libmylibrary.so
	  mylibrary.h
View paste
In android studio i do not have an Arm64 folder (but i can make one if needs be).
So i have just placed the  libmylibrary.so in the armeabi folder.

Where should i place the .h file?
Mark M.
um
let's back up a step
what exactly are you planning on doing with this .so?
Nov 12
9:00 AM
Mark M.
are you writing your own NDK code that will attempt to use it?
Matt
it's to include a library that captures the device's screen and allows key injections
Mark M.
which means it requires root
and that doesn't really answer my question: are you going to be writing your own NDK code that will attempt to use this .so?
or does the .so have JNI-style functions exposed?
Matt
View paste
The .so file are from Samsung Knox. They have told me to integrate with my project
im not sure
Mark M.
then you will need to ask Samsung
Matt
View paste
I have followed the following:
http://www.shaneenishry.com/blog/2014/08/17/ndk-with-android-studio/
Mark M.
for example, an arm64 binary does not go in an armeabi folder
if Samsung will not provide instructions for using the .so, then nobody else really is going to be able to help you
certainly I can't
Matt
i'll try dig out the post the gave me.... 1 minute
Mark M.
OK, so you need to write your own NDK code that uses this library
9:05 AM
Matt
so far i have put the .so in the jnilibs folder in the project
sorry mark , i've been called outside to move my car...typical... back in 2 mins
Mark M.
I have never tried using a precompiled .so, so I don't know the exact process there, other than a 64-bit binary (arm64) does not go in a 32-bit folder (armeabi)
OK
9:10 AM
Matt
Hi Back, There are 2 .so files, one in the arm64 and one outside of that folder. i presumed that the one outside the arm64 folder was the armeabi one.
is the best thing to ask Samsung then?
Mark M.
yes
Matt
i just wanted some help first in the set up of things
Mark M.
their instructions in that thread were, um, limited :-)
you might want to poke around a bit and get basic NDK builds set up in your project, ignoring their library for a bit
Matt
:) yep i know, butthey did say if i needed further assistance
Mark M.
write a C function that returns "Hello, world" or something and confirm you can talk to it from your app
Matt
do you know any good tutorial to hand?
Mark M.
well, I have a chapter on the NDK in my book
it's not great, as I don't do a lot of NDK work
Matt
ok i'll check that as well
Mark M.
(as in, nearly no NDK work)
my best "example" of using the NDK is my CWAC-AndDown project: https://github.com/commonsguy/cwac-anddown
for adding the hoedown Markdown processor to Android
frankly, Samsung should do what I do and package up an AAR that has the .so files and such in it
so they just tell people to add such-and-so repository and such-and-so compile statement to the dependencies list in the build.gradle file
and, boom, you have the library
chike
has entered the room
9:15 AM
Mark M.
Matt: let me take a question from chike, and I'll be back with you shortly
Matt
mmm the sounds better
ok
chike
Hi Mark
Mark M.
chike: hi! welcome to the chat! how can I help you today?
chike
Please i need help understanding SyncAdapters
Mark M.
since I have never used one, I probably cannot help you
but, you are welcome to ask
chike
ok so what do you use instead
Mark M.
um, anything else
chike
like what
Mark M.
if you mean "how do I exchange data with a server", I'll use an IntentService, with any number of possible triggers (push, AlarmManager, JobScheduler, manual invocation, etc.)
chike
ok. Mark now i get your point
i am good.. thank u
Mark M.
OK
chike
has left the room
Mark M.
Matt: back over to you!
9:20 AM
Matt
When you say write ndk code what do you mean exactly?
Mark M.
write C/C++ code
that uses the NDK to be included as part of an Android app
usually, that involves writing some JNI functions that serve as the C side of the bridge between your Java code in the app and the bulk of your C/C++ code
so, in their post, "Next, ensure to call RemoteDesktop APIs in the following sequence in the .cpp file"
"the .cpp file" is your C++ code to invoke their library
presumably doing so under direction from your Java-based Android app
Matt
so if i have the .so file in the correct folder how do i link the jni code from my app to their libray. there must be a way of mapping the functions?
Mark M.
well, in ordinary C/C++ development, you would tell the linker to include the .so files as part of your compilation
I presume that there is some equivalent as part of an NDK build
but, as I mentioned, I have never used a precompiled .so file
Matt
i think later in the post i gave you there is an option to compile the .so again in the project
9:25 AM
Matt
i think i need to get up to speed then maybe go back to Samsung.
Mark M.
I do not see what you are referring to, sorry
Matt
i just don't want to waste their time with my lack of knowledge, i need to break a few things down first
Mark M.
agreed -- start with some NDK basics, then once you're more comfortable with that, you should be in position to ask some more focused questions of Samsung
Matt
ok cheers, thanks and bye for now.
Matt
has left the room
9:55 AM
Mark M.
turned off guest access

Tuesday, November 10

 

Office Hours

People in this transcript

  • chike
  • Mark Murphy
  • Matt