简体   繁体   中英

For Android project how do I get maven to pickup all libraries in lib directory including .so files?

I have project that compiles and links fine when using Eclipse IDE. This project uses some external jar files and also uses some of JNI ( .so ) libraries.

They are all located in the libs/ directory of my project. How should my pom.xml file look like in order for all the jar files in libs/ folder and the shared objects are included in the APK. My libs directory looks something like this:

libs/
├── mydevicelib.jar
├── armeabi
│   ├── libdevice.so
├── armeabi-v7a
│   ├── libdevice.so
│   ├── libcmiris.so
├── libcommon.jar

I am using maven 3.0.5

These jars should be included as dependencies in the maven POM.

Rather than include them in a local lib folder they should be deployed to a maven repository.

For any artifacts that are available through maven central repository just include the dependency directly from there.

For custom artifacts, the best way to do this is to set up your own maven repository ( http://archiva.apache.org/index.cgi or http://www.sonatype.org/nexus/ ) and deploy the artifacts to that. Then you can include them as dependencies in the pom.

Alternatively, if this is overkill for your project, you can set up a local project repository and deploy the artifacts to that.

I havent actually done this with JNI libraries, though this link looks like it may contain useful info for doing a similar thing there: http://code.google.com/p/maven-android-plugin/wiki/NativeLibsAsDependencies . Looks like you just need to add the

<type>so</type>

element to the dependency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM