Coder Social home page Coder Social logo

Comments (15)

kenarsa avatar kenarsa commented on September 26, 2024

That seems to be the expected behavior as shared objects are exporting functions with JNI signature. Does that make sense?

from porcupine.

pabloxid avatar pabloxid commented on September 26, 2024

Maybe... but why do not expose C functions directly, as you do in Windows, Linux, raspberry, etc.?
You can do both things, as many android libraries do, like opencv for example.

from porcupine.

kenarsa avatar kenarsa commented on September 26, 2024

This is just how Android build system works by default. We didn't get any request for alternatives. What is your use case?

from porcupine.

pabloxid avatar pabloxid commented on September 26, 2024

I'm working on a project in which there is an Android application with a native part in a shared library. It's an embedded system and we need maximum performance. We want to integrate a voice command, but, by the way code is organized, audio and video parts are developed in C/C++. On the other hand, I think that it's more efficient to directly access the C API than to use the JNI interface, in this case.

from porcupine.

kenarsa avatar kenarsa commented on September 26, 2024

OK. Yeah, you might get some extra efficiency there. But it is minimal in this case as processing is done all in C and moving audio data around is fairly lite compared to image/video due to much smaller size.

I made a task to look into if we can expose extra functions in the shared object for v1.5 release. That would be the preferred solution.

In the meantime, the library is accessible from Java through JNI.

from porcupine.

pabloxid avatar pabloxid commented on September 26, 2024

Thank you.

For now, can you send me a compiled version to try? I'll confirm if it works.

from porcupine.

kenarsa avatar kenarsa commented on September 26, 2024

We have a task for it in our queue. I will update you when we start working on it.

from porcupine.

rtumelty avatar rtumelty commented on September 26, 2024

+1 to this request - I have been struggling to get Porcupine working in Unity for Android, as it expects developers to be using Java. Unity uses Mono (C#) or IL2CPP (C++) frameworks, which experience segmentation faults whenever I try to call the init function. It would be much more straightforward to interact directly with the Porcupine library.

from porcupine.

kenarsa avatar kenarsa commented on September 26, 2024

@rtumelty why not build against the shared object for Linux/Mac/Windows?

from porcupine.

rtumelty avatar rtumelty commented on September 26, 2024

I am building for Android devices with ARMv7 and ARM64 architectures. x86/64 libraries won't work for the platform.

from porcupine.

pabloxid avatar pabloxid commented on September 26, 2024

I notice that v1.5 is already out. Is this issue solved with that release?

from porcupine.

kenarsa avatar kenarsa commented on September 26, 2024

We didn't get to this feature. But we will be working on it. It is being tracked here as well #115. There are few candidate solutions and we are in the decision-making process.

from porcupine.

pabloxid avatar pabloxid commented on September 26, 2024

In fact, I don't understand why this issue occurs and why it's so difficult to fix it out.

The library is written in C, so the C API functions are there anyway. How is it possible to "hide" them? I include the .h header, so my code just compiles. Then the linker should find the functions there in the library, because the functions are there for sure, aren't they? That's very strange.

What I asked you by mail, since I actually work for a company that has bought or will buy a license, is that, in the meantime, simply take the source code you used for, say, the Linux library, and build it using NDK. I think that would be enough as a temporary solution for us. We don't need the JNI API, if the C API just works.

Thank you.

from porcupine.

kenarsa avatar kenarsa commented on September 26, 2024

The Android binding is designed to be used via a Java interface and using the lib from C is not supported currently. There are use cases that would benefit from using the lib on Android directly from C. This is NOT supported yet. I do appreciate your input. But it is a decision on the Picovoice side if we want to support it when to prioritize it, and how to get it done.

from porcupine.

kenarsa avatar kenarsa commented on September 26, 2024

we decided that we won't offer static libs for android. our offering for Android will be limited to shared objects and JNI interface.

from porcupine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.