Maven的编译错误包R不存在

Maven的编译错误包R不存在

本文介绍了Maven的编译错误包R不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到包r建设pom.xml文件不存在。

编译错误是:

  [INFO] 12编译源文件到E:\\ My_Work6 \\ AtosListReq \\目标\\班
[INFO] ----------------------------------------------- --------------
[错误]编译错误:
[INFO] ----------------------------------------------- --------------
[错误] E:\\ My_Work6 \\ MyListReq的\\ src \\ COM \\作为\\ dragsortandswipe \\ DragSortListView.java:[32,23]错误:无法找到符号
[错误]代码:R级
  位置:包com.as.listreq
E:\\ My_Work6 \\ MyListReq的\\ src \\ COM \\作为\\ dragsortandswipe \\ DragSortController.java:[17,23]错误:无法找到符号
[错误]代码:R级
  位置:包com.as.listreq
E:\\ My_Work6 \\ MyListReq的\\ src \\ COM \\作为\\ dragsortandswipe \\ DragSortListView.java:[406,6]错误:包R不存在
[错误] E:\\ My_Work6 \\ MyListReq的\\ src \\ COM \\作为\\ dragsortandswipe \\ DragSortListView.java:[409,6]错误:包R不存在
[错误] E:\\ My_Work6 \\ MyListReq的\\ src \\ COM \\作为\\ dragsortandswipe \\ DragSortListView.java:[412,6]错误:包R不存在
[错误] E:\\ My_Work6 \\ MyListReq的\\ src \\ COM \\作为\\ dragsortandswipe \\ DragSortListView.java:[419,29]错误:包R不存在
[错误] E:\\ My_Work6 \\ MyListReq的\\ src \\ COM \\作为\\ listreq \\ NextActivity.java:[41,40]的错误:包R不存在
[错误] E:\\ My_Work6 \\ MyListReq的\\ src \\ COM \\作为\\ listreq \\ NextActivity.java:[42,43]的错误:包R不存在



[错误]未能执行目标org.apache.maven.plugins:Maven的编译器插件:3.1:编译(默认编译)项目MyListReq:编译失败:编译失败:
[INFO] 58错误

下面是我的pom.xml文件:

 <项目的xmlns =htt​​p://maven.apache.org/POM/4.0.0的xmlns:XSI =htt​​p://www.w3.org/2001 / XML模式实例
    XSI:的schemaLocation =htt​​p://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">
    < modelVersion> 4.0.0< / modelVersion>
    <&的groupId GT; MyListReq< /的groupId>
    <&的artifactId GT; MyListReq< / artifactId的>
    <&版GT; 0.0.1-SNAPSHOT< /版本>
    <名称>&MYLIST LT; /名称>    <性状>
        < project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
        < project.reporting.outputEncoding> UTF-8< /project.reporting.outputEncoding>
    < /性状>
    <依赖和GT;
        <&依赖性GT;
            <&的groupId GT; com.google.android< /的groupId>
            <&的artifactId GT; Android设备和LT; / artifactId的>
            <&版GT; 4.1.1.4< /版本>
            <&范围GT;&编译LT; /&范围GT;
        < /依赖性>
        <&依赖性GT;
            <&的groupId GT; com.google.android< /的groupId>
            <&的artifactId GT;支持-V4< / artifactId的>
            <&版GT; R7< /版本>
        < /依赖性>
    < /依赖和GT;
    <建立>
        < sourceDirectory>&SRC LT; / sourceDirectory>
        <&插件GT;            <&插件GT;
                <&的artifactId GT; Maven的编译器插件< / artifactId的>
                <&版GT; 3.1< /版本>
                <结构>
                    <信源> 1.6 LT; /源>
                    <目标> 1.6 LT; /目标与GT;
                    <&叉GT;真< /前叉>
                    <可执行指令GT; C:\\ Program Files文件\\的Java \\ jdk1.7.0_03 \\ BIN \\的javac.exe
                    < /可执行>
                < /结构>
            < /插件>            <&插件GT;
                <&的groupId GT; com.jayway.maven.plugins.android.generation2< /的groupId>
                <&的artifactId GT; Android的Maven的插件< / artifactId的>
                <结构>
                    < SDK开发及GT;
                        <路径> $ {env.ANDROID_HOME}< /路径>
                        <平台和GT; 17< /平台>
                    < / SDK>
                < /结构>
                <附加功能,GT;真< /扩展>
            < /插件>        < /插件>
    < /构建>
< /项目>


解决方案

您已经添加com.jayway.maven.plugins.android.generation2插件,

添加包装apklib,像这样的:

 <&版GT; 0.0.1-SNAPSHOT< /版本>
<包装和GT; apklib< /包装>

这是确定

I am getting package R does not exist on building pom.xml file.

Compilation Error is:

[INFO] Compiling 12 source files to E:\My_Work6\AtosListReq\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] E:\My_Work6\MyListReq\src\com\as\dragsortandswipe\DragSortListView.java:[32,23] error: cannot find symbol
[ERROR]   symbol:   class R
  location: package com.as.listreq
E:\My_Work6\MyListReq\src\com\as\dragsortandswipe\DragSortController.java:[17,23] error: cannot find symbol
[ERROR]   symbol:   class R
  location: package com.as.listreq
E:\My_Work6\MyListReq\src\com\as\dragsortandswipe\DragSortListView.java:[406,6] error: package R does not exist
[ERROR] E:\My_Work6\MyListReq\src\com\as\dragsortandswipe\DragSortListView.java:[409,6] error: package R does not exist
[ERROR] E:\My_Work6\MyListReq\src\com\as\dragsortandswipe\DragSortListView.java:[412,6] error: package R does not exist
[ERROR] E:\My_Work6\MyListReq\src\com\as\dragsortandswipe\DragSortListView.java:[419,29] error: package R does not exist
[ERROR] E:\My_Work6\MyListReq\src\com\as\listreq\NextActivity.java:[41,40] error: package R does not exist
[ERROR] E:\My_Work6\MyListReq\src\com\as\listreq\NextActivity.java:[42,43] error: package R does not exist
.
.
.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project MyListReq: Compilation failure: Compilation failure:
[INFO] 58 errors

Below is my pom.xml file:

    <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>MyListReq</groupId>
    <artifactId>MyListReq</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>MyList</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>


    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.1.1.4</version>
            <scope>compile</scope>
        </dependency>


        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>support-v4</artifactId>
            <version>r7</version>
        </dependency>
    </dependencies>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <fork>true</fork>
                    <executable>C:\Program Files\Java\jdk1.7.0_03\bin\javac.exe
                    </executable>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <path>${env.ANDROID_HOME}</path>
                        <platform>17</platform>
                    </sdk>
                </configuration>
                <extensions>true</extensions>
            </plugin>

        </plugins>
    </build>
</project>
解决方案

You have added com.jayway.maven.plugins.android.generation2 plugin,

Adding packaging to apklib, like this:

<version>0.0.1-SNAPSHOT</version>
<packaging>apklib</packaging>

That's ok

这篇关于Maven的编译错误包R不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:49