kingdom578 / maven-android-plugin

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

Missing architectures in apklib with native code apklib dependency #429

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create new apklib project
2. Add other apklib with native code to maven dependency
3. Compile project

What is the expected output?
Result apklib should contain libs directory with all architectures that are 
present in original dependency apklib with native code

What do you see instead?
Result apk contains only one architecture (armeabi)

What version of maven-android-plugin are you using?
3.8.0 (same with older versions)

What are the complete output lines of "mvn -version" on your machine?
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 
17:22:22+0200)
Maven home: c:\Programs\apache-maven
Java version: 1.7.0_10, vendor: Oracle Corporation
Java home: c:\Program Files\Java\jdk1.7.0_10\jre
Default locale: en_US, platform encoding: Cp1250
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

Please provide any additional information below.
The problem is visible in official samples, compile and check 
maven-android-plugin-samples/native/transient-apklib-with-native 

Original issue reported on code.google.com by pern...@gmail.com on 25 Nov 2013 at 11:27

GoogleCodeExporter commented 9 years ago
Any workaround to be able to have all architecture libs present in original 
dependency apklib?

Original comment by pena...@gmail.com on 24 Jan 2014 at 12:57

GoogleCodeExporter commented 9 years ago
It would be awesome if this could be corrected.

Original comment by ilantzco...@gmail.com on 24 Jan 2014 at 1:41

GoogleCodeExporter commented 9 years ago
To get all architectures just add ndkArchitecture configuration onto your 
pom.xml:
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <platform>${sdk.platform}</platform>
                    </sdk>
                    <ndkArchitecture>armeabi armeabi-v7a x86</ndkArchitecture>
                </configuration>
            </plugin>

But in order to work maven android plugin version must be: 3.8.2 (with maven 
3.1.1)

Original comment by pena...@gmail.com on 28 Jan 2014 at 1:55

GoogleCodeExporter commented 9 years ago
So your APK at least contains a /lib folder? Using any plugin from 3.6.x and 
up, my resulting APK doesn't contain the /libs contents of the APKLIB that was 
referenced in the APK project. The 3.5.x versions of the plugin work as 
expected.

What is your pom configuration for the APKLIB dependency? Thanks in advance.

Original comment by j.bros...@gmail.com on 5 Feb 2014 at 10:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The whole pom.xml to include all architecture dependencies would something like:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>1.0.0</modelVersion>
    <groupId>groupIdName</groupId>
    <artifactId>artifactId</artifactId>
    <version>my_version</version>
    <packaging>apk</packaging>
    <name>myApkApp</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <dependencies>
        <dependency>
            <!--android dependency-->
            <groupId>android</groupId>
            <artifactId>android</artifactId>
            <version>4.2.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <!--my librery with 3 different architectures dependecy-->
            <groupId>library</groupId>
            <artifactId>library</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <type>apklib</type>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
           <id>my_nexus_repo</id>
            <url><id>my_nexus_repo</id></url>
        </repository>
    </repositories>
    <build>
        <finalName>${project.artifactId}</finalName>
        <sourceDirectory>src</sourceDirectory>
        <pluginManagement>
            <plugins>
                <!--maven android plugin-->
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>3.8.2</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <!-- platform or api level (api level 4 = platform 1.6) -->
                        <platform>19</platform>
                    </sdk>
                    <!--needed to add the 3 architectures. Other wise it will add just armeabi-->
                    <ndkArchitecture>armeabi armeabi-v7a x86</ndkArchitecture>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

But really important: maven android plugin version must be: 3.8.2 (with maven 
3.1.1)

Original comment by pena...@gmail.com on 5 Feb 2014 at 11:12

GoogleCodeExporter commented 9 years ago
Here's what I tried:
1. using the example app from #444 as a starting point
2. added all architectures as per comment in #440 (so apklib has multiple 
foo.so)
3. copied apklib1 into a apklib2 (changing references) and renamed the apklib2 
versions to bar.so
4. modified the apk to depend on apklib2 instead of apklib1

I built all of them using the pull request in #444

Expectation was that the apk should contain multiple foo.so and multiple bar.so
Instead apklib2 output only contained bar.so files, so apk also only contained 
those files

It appears that the apklib as a dependency of another apklib didn't get the 
native dependencies copied in (and thus the same is true of the resulting apk)

Original comment by malac...@gmail.com on 22 Mar 2014 at 9:14

GoogleCodeExporter commented 9 years ago
It appears that apklib2 is not calling getNativeDependenciesArtifacts on 
apklib1.

Original comment by malac...@gmail.com on 22 Mar 2014 at 9:32

GoogleCodeExporter commented 9 years ago
Looks like ApklibMojo.addNativeLibraries should be doing it. Investigating.

Original comment by malac...@gmail.com on 22 Mar 2014 at 9:37

GoogleCodeExporter commented 9 years ago
Issue was caused by the transitive apklibs only being checked if the native 
libs dir didn't exist. Moved that logic outside the code block.

Pull request depends on the issue-444 pull request #313
https://github.com/jayway/maven-android-plugin/pull/314

Original comment by malac...@gmail.com on 22 Mar 2014 at 10:02

GoogleCodeExporter commented 9 years ago
We are no longer using the issue tracking system on Google Code. Please refile 
this issue on https://github.com/jayway/maven-android-plugin/issues if you 
still have this problem with the latest release of the Android Maven Plugin

Original comment by mosa...@gmail.com on 19 May 2014 at 4:20