简体   繁体   English

Android Maven项目 - 在pom.xml中收到错误

[英]Android Maven Project - getting error in pom.xml

I got this error when i adding this line to my pom.xml file in maven project 当我将此行添加到maven项目中的pom.xml文件时,我收到此错误

Here is my pom.xml file 这是我的pom.xml文件

<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>4.0.0</modelVersion>
<groupId>GROUPID</groupId>
<artifactId>ARTIFACTID</artifactId>
<version>VERSION</version>
<packaging>apk</packaging>  <!-- Getting error in this line -->
<name>NAME</name>
<dependencies>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.4.3</version>
    </dependency>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>2.2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.4</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>support-v4</artifactId>
        <version>r6</version>
    </dependency>
</dependencies>
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>1.0</version>
            </plugin>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <sdk>
                        <platform>9</platform>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
<repositories>
    <repository>
        <id>project.local</id>
        <name>project</name>
        <url>file:${project.basedir}/repo</url>
    </repository>
</repositories>

I am getting this error when adding pom.xml in apk. 我在apk中添加pom.xml时收到此错误。

I referred to this question Android with maven? 用maven提到了Android的这个问题 Apk unknown Apk未知

But mvn clean install doesn't help me... So please help me to get rid of this error. 但是mvn clean install对我没有帮助......所以请帮我摆脱这个错误。 Thanks in advance. 提前致谢。

Try moving those plugins, particularly the android-maven-plugin outside of <pluginManagement>. 尝试移动这些插件,尤其是<pluginManagement>之外的android-maven-plugin。 When specified inside <pluginManagement> they don't run so the android-maven-plugin extension isn't seen so maven doesn't know what to do with the "apk" packaging. 当在<pluginManagement>中指定时,它们不会运行,因此看不到android-maven-plugin扩展,所以maven不知道如何处理“apk”包装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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