dependencies.dependency.version' for com.googl

2020-08-09 06:39发布

问题:

i am trying to run a simple dummy android project with eclipse and also i am trying to use maven. amd i have followed the tutorial of the accepted answer on this post

this is my 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>

and this is my console log :

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

can any one tell what should i do to run this simple project?

EDIT: as S.D answerd, i pasted these lines in CMD and that solved the problem :

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"

回答1:

You need to provide an appropriate version:

<platform.version>4.1.1.4</platform.version>

Choose a version available here.

If that version is not available and you have a later version installed from SDK manager, then you can install that android.jar to local maven repository:

If $ANDROID_HOME is path to Android SDK folder, and you want version 4.0.3 which is under android-15 folder, then Run:

mvn install:install-file \
 -Dfile=$ANDROID_HOME/platforms/android-15/android.jar \
 -DgroupId=com.google.android \
 -DartifactId=android \
 -Dversion=4.0.3 \
 -Dpackaging=jar \
 -DgeneratePom=true

For Windows user:

mvn install:install-file -Dfile=%ANDROID_HOME%\platforms\android-15\android.jar -DgroupId=com.google.android -DartifactId=android -Dversion=4.0.3 -Dpackaging=jar -DgeneratePom=true


回答2:

You need to fill the platform.version property (4.3 for API level 18):

<platform.version>4.3</platform.version>


回答3:

The commands that installs the binary jar and the sources jar, if it has been downloaded. A windows version is left as an exercise for the reader.

    mvn install:install-file -Dfile=platforms/android-19/android.jar \
        -DgroupId=com.google.android -DartifactId=android \
        -Dversion=19 -Dpackaging=jar
    (cd sources/android-19;
        jar cvf ../../platforms/android-19/android-sources.jar .)
    mvn install:install-file -Dfile=platforms/android-19/android-sources.jar \
        -DgroupId=com.google.android -DartifactId=android \
        -Dversion=19 -Dclassifier=sources -Dpackaging=jar

And in the dependencies section

<dependency>
    <groupId>com.google.android</groupId>
    <artifactId>android</artifactId>
    <version>19</version>
</dependency>

You may want to use a version number scheme that android version and not the platform version but I like this.