如何使用.so文件来创建Android应用程序的.apk文件为我定制视频codeC [英] How to use .so file to create an .apk file in android application for my custom video codec

查看:149
本文介绍了如何使用.so文件来创建Android应用程序的.apk文件为我定制视频codeC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个应用程序或.apk文件可以在特定格式播放视频。

i want create an app or .apk file which can play video in particular format.

有关这个我已经编译了一个源文件,并采取目标文件,
从目标文件我已经生成一个共享库文件(的.so)使用命令

For this I had compiled my source files and taken object files, from object files i have generated one shared library file (.so) using command

gcc -c -fPIC hello.c -o hello.o
gcc hello.o -shared -o libhello.so 

有人可以请帮助我的步骤从Android的Eclipse或.so文件创建APK文件Android SDK中

can somebody please help me with the steps to create apk file from .so file in android Eclipse or android sdk

什么是java文件的importence同时创造一个apk文件...

what is the importence of java files while creating an apk file...

推荐答案

从你上面已经放了,I $你不使用工具链编译您的自定义去codeR $ C $中c p $ psume由Android NDK提供。我已经完成,你应该做同样的工作。

From what you have put up above, i presume that you are not compiling your custom decoder code using the tool chains provided by android ndk. I have performed the same task which you are supposed to do.

First of all what you need to do is:

1)创建一个Android项目

1) Create a Android project

2)一侧的Andr​​oid项目的根目录下,创建一个文件夹,名为JNI

2) In side the root directory of the Android project, create a folder called "jni"

3)所有Ccode转储(定制德codeRS code)到这个文件夹。

3) Dump in all your "C" code (custom decoders code) into this folder.

4)创建有去codeR $ C $相同c / JNI 文件夹中的文件,并将该文件命名为 Android.mk 。如果你知道在linux make文件的概念,同样的事情在这里意味着,只有语法的变化。(可以参考沿的Andr​​oid NDK自带一些示例的例子)。

4) Create a file in the same /jni folder which has the decoder code and name the file as Android.mk . If you know the concept of make files in linux, the same thing implies here, only the syntax changes.(you can refer to some sample examples that comes along android ndk).

5)下载 Android的NDK 从的开发者网站(它也有可以参考他们学习这样的例子)。

5) Download Android-ndk from the developers website ( it also has sample examples you can refer them to learn it).

6)配置PATH变量NDK目录。

6) Configure PATH variable to ndk directory.

例如:出口NDK_PATH = /家庭/ MYPC / Android的NDK-R7B

Eg: export NDK_PATH=/home/myPC/android-ndk-r7b

7)cd到JNI目录,键入命令 NDK的构建。如果everyting顺利的话,你现在已经产生了.so文件,这意味着你的code已经成功交叉编译到Android平台。

7) cd to jni directory and type the command ndk-build. If everyting goes well you will now have a .so file generated, which means your code has been successfully cross-compiled to android platform.

8)现在在/ src文件夹中,你将有一个.java文件,从中你将必须加载生成的.so文件。为此,您可以参考样本例子的Andr​​oid NDK。

8) Now in the /src folder you will have a .java file, from which you will have to load the .so file generated. For this you can refer the sample examples in android ndk.

9)使用JNI您的应用程序和.so之间产生连接。例如,如果您的自定义去codeR的目的是要输入文件指针脱code中的文件时,相应的你将不得不实现的JNI code。

9) Use JNI to interface between your application and .so generated. For example if your custom decoder is designed to take an input file pointer to decode the file, the accordingly you will have to implement the JNI code.

10)最后,当你做了所有的,如果你去codeR为您提供RGB数据,那么你可以使用OpenGL ES来显示本机code去codeD的照片仅

10) Finally when you have done all, and if your decoder is providing you with RGB data, then you can use openGL ES to display the decoded pictures from the native code only.

这篇关于如何使用.so文件来创建Android应用程序的.apk文件为我定制视频codeC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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