我正在尝试使用 eclipse 运行一个简单的虚拟 android 项目,并且我正在尝试使用 maven。amd 我已经按照这篇文章中接受的答案的教程进行操作
这是我的 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ir.raysis</groupId>
<artifactId>quickie</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<name>quickie</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version></platform.version>
<android.plugin.version>3.5.3</android.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.plugin.version}</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>18</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
</project>
这是我的控制台日志:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.raysis:quickie:0.0.1-SNAPSHOT (D:\RaySIS\programming\RaySISPP\TISWS\quickie\pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for com.google.android:android:jar is missing. @ line 21, column 13
[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/ProjectBuildingException
谁能告诉我应该怎么做才能运行这个简单的项目?
编辑:正如 SD 回答的那样,我在 CMD 中粘贴了这些行并解决了问题:
mvn install:install-file "-Dfile=%ANDROID_HOME%/platforms/android-18/android.jar" "-DgroupId=com.google.android" "-DartifactId=android" "-Dversion=4.3" "-Dpackaging=jar" "-DgeneratePom=true"