Android的NDK Android Studio中 [英] Android NDK in Android Studio

查看:217
本文介绍了Android的NDK Android Studio中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着去跛脚的lib在我的应用程序,以便在录制MP3格式的音频集成。
今天的Andr​​oid不支持MP3编码本身然而,随着一些挖我发现我可以用蹩脚的lib,但问题是,跛脚LIB位于c code。
更多阅读后,我发现,使其正常工作是使用C code到我的项目编译成库通过JNI或类似的东西期运用NDK的唯一途径。

Im trying to integrate lame lib in my application in order to record audio in mp3 format. Today android don't support mp3 encoding natively however with some digging i have found that i can use lame lib but the problem is , lame lib is in c code. after more reading i found out the only way to make it work correctly is to use the c code into my project compile it as a library useing NDK through JNI or something like that.

我的问题是,我真的不明白这一切的NDK和JNI,最重要的是我不知道如何与And​​roid STUDIO运行本地code!我当这个页面并阅读一些关于它,但他们还是无法T何况还有如何做到这一点在Android Studio中。我真的很迷惑在这里。

My problem is that i don't really understand all this NDK and JNI and most importantly i don't know how to run native code with ANDROID STUDIO! I when to this page and read a bit about it but still they don't mention there how to do it in android studio. i am really confuse here.

我的问题是:

- 请我怎么能整合NDK与Android工作室(只要我看了一些比较幸运的,因为它更容易使用Eclipse,我不使用)

-Please how can I integrate NDK with ANDROID studio (as far as i have read some are more lucky because its easier with Eclipse which i dont use)

-Is有使用或到lameLib导入到我的项目,而不NDK任何其他方式?

-Is there any other way to use or to import the lameLib into my project without NDK?

感谢您

推荐答案

您应该了解JNI。这很复杂。生成一个大项目的包装,最好的办法是使用痛饮自动生成它们。我建议您按照痛饮Android的教程来学习痛饮。 http://www.swig.org/Doc2.0/Android.html

There are two steps you need to take

1: Create the JNI wrappers

You should read about JNI. It's complicated. The best way to generate wrappers for a large project is to use Swig to auto generate them. I recommend following the swig android tutorial to learn swig. http://www.swig.org/Doc2.0/Android.html

请参阅我的<一个href=\"http://stackoverflow.com/questions/16667903/android-studio-gradle-and-ndk/24083451#24083451\">answer另一个问题,获取有关如何设置NDK的Andr​​oid Studio的详细说明。

See my answer to another question for detailed instructions on how to set up ndk with Android Studio.

这篇关于Android的NDK Android Studio中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆