pitate7777777 / maven-android-plugin

Automatically exported from code.google.com/p/maven-android-plugin
0 stars 0 forks source link

Native libs not included in APK using 3.5.3 #372

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Declare native library dependencies in your project
2. Build using plugin version 3.5.3
3. Check the resulting APK for containing *.so files in /libs

What is the expected output?
The APK contains the *.so files under /libs.

What do you see instead?
No native libs are present in the APK.

What version of maven-android-plugin are you using?
3.5.3

What are the complete output lines of "mvn -version" on your machine?
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_21, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.5.0-27-generic", arch: "amd64", family: "unix"

Please provide any additional information below.
Have not tested 3.5.2, but 3.5.1 is working properly for me.

Original issue reported on code.google.com by j.bros...@gmail.com on 25 Apr 2013 at 8:24

GoogleCodeExporter commented 9 years ago
I'm currently using:
android-maven-plugin v 3.5.3
maven 3.0.3

*.so files are in maven's local repo, dependencies are specified as 
https://code.google.com/p/maven-android-plugin/wiki/NativeLibsAsDependencies

Building with android-maven-plugin 3.5.3 does NOT include the libs in the apk

Building with android-maven-plugin 3.5.1 does work properly

Original comment by dpe...@amplify.com on 30 Apr 2013 at 5:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have the same problem, I've tested versions: 3.5.2 and 3.5.3.

With version 3.5.1 everything works correctly.

mvn -version outuput is:
Maven home: /opt/maven
Java version: 1.7.0_21, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk/jre
Default locale: es_ES, platform encoding: UTF-8
OS name: "linux", version: "3.9.3-1-arch", arch: "amd64", family: "unix"

Original comment by santosca...@gmail.com on 22 May 2013 at 8:00

GoogleCodeExporter commented 9 years ago
I've solved the issue adding the classifier to the so dependency. I've only 
tested the fix with 3.5.3 but I suppose that it can work with 3.5.2 too because 
I think is related with this change: 
https://github.com/jayway/maven-android-plugin/pull/187

Original comment by santosca...@gmail.com on 23 May 2013 at 8:30

GoogleCodeExporter commented 9 years ago
Could you elaborate on your fix "adding the classifier"? What exactly did you 
do? Thanks.

Original comment by j.bros...@gmail.com on 23 May 2013 at 8:38

GoogleCodeExporter commented 9 years ago
I need a fix too.

Here is a workaround that manually copy the native maven dependency into the 
target directory before building the app.

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.5.1</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId> [native lib groupid] </groupId>
                                    <artifactId> [native lib artifactId] </artifactId>
                                    <version> [native lib version] </version>
                                    <type>so</type>                                   
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/libs/armeabi</outputDirectory>
                                    <destFileName>[native lib name].so</destFileName>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>target/libs/armeabi</outputDirectory>
                            <overWriteReleases>true</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Hope it helps

Original comment by fabrice....@gmail.com on 31 May 2013 at 9:42

GoogleCodeExporter commented 9 years ago
Just tried 3.6.0 and this bug still exists! Please just fix it.

Original comment by j.bros...@gmail.com on 11 Jun 2013 at 1:38

GoogleCodeExporter commented 9 years ago
Just tried AGAIN with 3.6.1 and this issue is still present. Please give this 
more priority; version 3.5.1 is the latest that works correctly!

Original comment by j.bros...@gmail.com on 2 Sep 2013 at 9:23

GoogleCodeExporter commented 9 years ago
This issue is getting more annoying now that the newer SDK versions (17,18) 
have the build tools moved to a new directory and the 3.5.1 of the plugin, the 
latest that correctly includes native libraries can't handle the new SDK build 
tools location.

A dirty fix is to recursively copy the contents of 
<android-sdk>/build-tools/<version> over to <android-sdk>/platform-tools/ but 
in the end this issues just needs to be fixed.

Original comment by j.bros...@gmail.com on 4 Sep 2013 at 9:37

GoogleCodeExporter commented 9 years ago
I have submitted the following pull request to fix this issue: 
https://github.com/jayway/maven-android-plugin/pull/231

See the pull request for an explanation of the issue.

If you are experiencing this issue I would appreciate it if you could checkout 
my fix and see if it fixes the issue for you.

Original comment by charles....@gmail.com on 6 Sep 2013 at 4:30

GoogleCodeExporter commented 9 years ago
Turns out it's just poor documentation. Just add this to your poms:

    <dependency>
      <groupId>com.holmes</groupId>
      <artifactId>something-native</artifactId>
      <version>${project.version}</version>
      <type>so</type>
      <classifier>armeabi</classifier>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.holmes</groupId>
      <artifactId>something-native</artifactId>
      <version>${project.version}</version>
      <type>so</type>
      <classifier>armeabi-v7a</classifier>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.holmes</groupId>
      <artifactId>something-native</artifactId>
      <version>${project.version}</version>
      <type>so</type>
      <classifier>x86</classifier>
      <scope>runtime</scope>
    </dependency>

Original comment by holme...@gmail.com on 10 Sep 2013 at 3:08

GoogleCodeExporter commented 9 years ago
Doesn't defining the classifier in the POM dependency require that the artifact 
was originally deployed with that classifier? Not always possible to correct 
the dependency repository if it isn't under your control.

Original comment by charles....@gmail.com on 10 Sep 2013 at 10:33

GoogleCodeExporter commented 9 years ago
Merged pull request. Will be out with release after 3.6.1 (not sure of number 
yet)

Original comment by mosa...@gmail.com on 18 Sep 2013 at 4:12

GoogleCodeExporter commented 9 years ago
version 3.7.0 is available today on public repository and fix the bug for me

Thank you !

Original comment by fabrice....@gmail.com on 18 Oct 2013 at 8:50