Packaging a native library into an APK

回眸只為那壹抹淺笑 提交于 2020-01-02 07:03:43

问题


How do I do this from Eclipse? I can't find any way. I tried creating a build.xml with the following and adding it as the final builder:

<?xml version="1.0" encoding="UTF-8"?>
<project name="MobileRecovery" default="mergelibs">
<loadproperties srcFile="local.properties" />
<property file="ant.properties" />
<loadproperties srcFile="project.properties" />
<fail unless="sdk.dir" message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'" />
<!-- version-tag: custom -->
<import file="${sdk.dir}/tools/ant/build.xml" />
<target name="mergelibs">
    <apkbuilder outfolder="bin" verbose="true" apkfilepath="bin/MobileRecovery.apk">
        <file path="bin/classes.dex" />
        <nativefolder path="libs" />
    </apkbuilder>
</target>
</project>

but all that achieves is the output apkbuilder doesn't support the nested "file" element.

At this point I'm not interested in the whys and hows of what I'm doing wrong, if someone can just give me a solution that WORKS I'll figure out the theory behind it.


回答1:


Place your native library in \libs\armeabi directory of your project folder and Eclipse will put it in the package.



来源:https://stackoverflow.com/questions/7853732/packaging-a-native-library-into-an-apk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!