Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/217.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在Maven for Android应用程序中执行目标_Android_Maven - Fatal编程技术网

无法在Maven for Android应用程序中执行目标

无法在Maven for Android应用程序中执行目标,android,maven,Android,Maven,我是Maven的新手,我几乎已经完成了pom.xml的编写,但是每次我稍微向前一点,我都会遇到另一个错误。这次此错误如下所示: [INFO] ------------------------------------------------------------------------ [INFO] Building RecipeGrazer - App 1.0.0-SNAPSHOT [INFO] -----------------------------------------------

我是Maven的新手,我几乎已经完成了pom.xml的编写,但是每次我稍微向前一点,我都会遇到另一个错误。这次此错误如下所示:

  [INFO] ------------------------------------------------------------------------
[INFO] Building RecipeGrazer - App 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ NotepadAndroid ---
[INFO] Deleting /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/target
[INFO] 
[INFO] --- android-maven-plugin:3.6.1:generate-sources (default-generate-sources) @ NotepadAndroid ---
[INFO] ANDROID-904-002: Found aidl files: Count = 1
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] Manifest merging disabled. Using project manifest only
[INFO] /Users/username/Desktop/sdk/build-tools/18.0.1/aapt [package, -m, -J, /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/target/generated-sources/r, -M, /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/AndroidManifest.xml, -S, /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/res, --auto-add-overlay, -A, /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/assets, -I, /Users/username/Desktop/sdk/platforms/android-10/android.jar]
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ NotepadAndroid ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/src/main/resources
[INFO] skip non existing resourceDirectory /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/target/generated-sources/extracted-dependencies/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ NotepadAndroid ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 309 source files to /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.899s
[INFO] Finished at: Thu Aug 22 12:25:43 CEST 2013
[INFO] Final Memory: 18M/367M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project NotepadAndroid: Fatal error compiling: invalid target release: 2.3.3 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
有什么问题吗?我更改了API,但仍然得到相同的错误

以下是我的pom的主要部分:

roperty>
发展
com.google.android
安卓
2.3.3
假如
com.google.android
支持-v4
r7
公地io
公地io
20030203.000550
com.google.code.gson
格森
2.2.4
番石榴
番石榴
12.0.1
com.google.inject
圭斯
2.0-no_aop
com.google.http-client
谷歌http客户端android
1.16.0-rc
org.apache.httpcomponents
httpime
4.2.5
com.google.protobuf
protobuf java
2.4.1
org.roboguice
机器人向导
2
路标
路标-HTTP4
1.2.1.1
org.twitter4j
twitter4j核
2.1.11
src
org.apache.maven.plugins
maven编译器插件
3.1
UTF-8
2.3.3
2.3.3
com.jayway.maven.plugins.android.generation2
安卓maven插件
3.6.1
10
22
真的
假的
真的

由于构建在
maven编译器插件:compile
目标上失败,很可能是:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>2.3.3</source>
                <target>2.3.3</target>
            </configuration>
        </plugin>

org.apache.maven.plugins
maven编译器插件
3.1
UTF-8
2.3.3
2.3.3
源和目标版本参数适用于Java版本,Android版本,也就是说,您应该有如下内容:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

org.apache.maven.plugins
maven编译器插件
3.1
UTF-8
1.6
1.6

我怀疑如果您使用
-X
参数运行构建(正如Maven本身所建议的),您会得到一些相关信息。

由于构建在
Maven编译器插件:compile
目标上失败,很可能是:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>2.3.3</source>
                <target>2.3.3</target>
            </configuration>
        </plugin>

org.apache.maven.plugins
maven编译器插件
3.1
UTF-8
2.3.3
2.3.3
源和目标版本参数适用于Java版本,Android版本,也就是说,您应该有如下内容:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

org.apache.maven.plugins
maven编译器插件
3.1
UTF-8
1.6
1.6

我怀疑如果你用
-X
参数运行你的构建(正如Maven本身所建议的),你会得到一些这样的信息。

试试这个。它会对你有所帮助

将其添加到pom.xml文件中

<build>
 <plugins>
   <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.0</version>
        <configuration>
            <encoding>UTF-8</encoding>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>
 </plugins>

org.apache.maven.plugins
maven编译器插件
3.6.0
UTF-8
1.8
1.8

您可以将1.8更改为jdk版本

此后

右键单击项目-->属性-->Java生成路径

在库标记中

选择JRE系统库-->单击编辑-->工作区默认JRE选项-->JRE-->edid-->目录-->jdk

然后回去


这将对你有帮助。试试这个。它将对你有帮助

将其添加到pom.xml文件中

<build>
 <plugins>
   <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.0</version>
        <configuration>
            <encoding>UTF-8</encoding>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>
 </plugins>

org.apache.maven.plugins
maven编译器插件
3.6.0
UTF-8
1.8
1.8

您可以将1.8更改为jdk版本

此后

右键单击项目-->属性-->Java生成路径

在库标记中

选择JRE系统库-->单击编辑-->工作区默认JRE选项-->JRE-->edid-->目录-->jdk

然后回去


这将帮助你

是的,我知道了,只是忘了发了。这就是解决办法。是的,我知道了,只是忘了发帖。这就是解决办法。