问题
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