Maven使用Android库项目和ADT

时间:2021-03-25 23:56:37

How can i use Maven to successfully configure android library type project under Android Development Toolkit

如何使用Maven在Android Development Toolkit下成功配置android库类型项目

I am able to add a packaging type AAR but the classes from the lirbary project are not visible/available.

我能够添加包装类型AAR,但lirbary项目中的类不可见/可用。

I want to be able to see the referenced classes in my build path for development as currently m2e plugin does not support this.

我希望能够在我的构建路径中看到引用的类用于开发,因为目前m2e插件不支持此功能。

1 个解决方案

#1


2  

I have been able to accomplish this with the newest release of the android-maven-plugin

我已经能够使用android-maven-plugin的最新版本完成此任务

v 3.8.2 that supports and integrates AAR library packaging

v 3.8.2,支持和集成AAR库包

In order to use the generated Library files within your ADT workspace: Add the generated folder from target/unpacked-libs as source folder to work with while developing.

要在ADT工作空间中使用生成的库文件:将生成的文件夹从target / unpacked-libs添加为源文件夹,以便在开发时使用。

BuildPath-> Use as source folder

BuildPath->用作源文件夹

If someone has a better way to doing this please share..

如果有人有更好的方法,请分享..

Maven 3.1.1+

Sample Maven Configuration:

示例Maven配置:

            <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <version>${android-maven-plugin-version}</version>
            <goals>
                <goal>consume-aar</goal>
            </goals>
            <extensions>true</extensions>
            <configuration>
                <sdk>
                    <platform>${android-platform}</platform>
                </sdk>
                <deleteConflictingFiles>true</deleteConflictingFiles>
                <undeployBeforeDeploy>true</undeployBeforeDeploy>
            </configuration>
        </plugin>

#1


2  

I have been able to accomplish this with the newest release of the android-maven-plugin

我已经能够使用android-maven-plugin的最新版本完成此任务

v 3.8.2 that supports and integrates AAR library packaging

v 3.8.2,支持和集成AAR库包

In order to use the generated Library files within your ADT workspace: Add the generated folder from target/unpacked-libs as source folder to work with while developing.

要在ADT工作空间中使用生成的库文件:将生成的文件夹从target / unpacked-libs添加为源文件夹,以便在开发时使用。

BuildPath-> Use as source folder

BuildPath->用作源文件夹

If someone has a better way to doing this please share..

如果有人有更好的方法,请分享..

Maven 3.1.1+

Sample Maven Configuration:

示例Maven配置:

            <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <version>${android-maven-plugin-version}</version>
            <goals>
                <goal>consume-aar</goal>
            </goals>
            <extensions>true</extensions>
            <configuration>
                <sdk>
                    <platform>${android-platform}</platform>
                </sdk>
                <deleteConflictingFiles>true</deleteConflictingFiles>
                <undeployBeforeDeploy>true</undeployBeforeDeploy>
            </configuration>
        </plugin>