Search code examples
javaandroideclipsemavenm2eclipse

How to make m2e-android include native deps for apk packaging?


A follow-up of this question. I'm using libgdx, and hence have added (among others) the following deps to my POM, as per this wiki page:

        <dependency>
            <groupId>com.badlogic</groupId>
            <artifactId>libgdx-armeabi-gdx</artifactId>
            <version>${libgdx.version}</version>
            <scope>runtime</scope>
            <type>so</type>
        </dependency>

        <dependency>
            <groupId>com.badlogic</groupId>
            <artifactId>libgdx-armeabi-androidgl20</artifactId>
            <version>${libgdx.version}</version>
            <scope>runtime</scope>
            <type>so</type>
        </dependency>

where libgdx.version is a property I set in the POM (currently at 0.9.3, all artifacts are loaded in the repo, the libgdx native loading sequence is changed to account for the non-standard filenames, etc.).

Here's the problem: I'm using ADT in Eclipse with the m2e-android connector, and when I launch the project from ADT, it fails to finds these native libraries in the APK.

On the other hand, if I launch using the appropriate Maven goals, the APK builds fine, with those .so libraries correctly placed in lib/armeabi.

Is this a deficiency in the current version of m2e-android (I did notice some bugs on GitHub, but those were related to NDK development, not native dependencies per se), and I just have to wait for a new version? Or can I add something to my POM that will cause m2e-android to "see" those deps?


Solution

  • Unfortunately, m2e-android does not yet support native library dependencies. We are aware of the problem, and there are issues for these. We could directly implement support for native libraries directly:

    https://github.com/rgladwell/m2e-android/issues/71

    Or we could replace the ADT APK native builder, with a Maven APK builder:

    https://github.com/rgladwell/m2e-android/issues/67

    Patches and pull requests gratefully considered.