【问题标题】:maven android error reading file source.propertiesmaven android错误读取文件source.properties
【发布时间】:2014-06-26 06:18:15
【问题描述】:

我正在尝试构建一个简单的 hello world android 应用程序。我收到此错误:

Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven- 
plugin:3.9.0-rc.2:generate-sources (default-generate-sources) on project ndbc: 
Execution default-generate-sources of goal 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.2:generate-
sources failed: Error reading /storage/code/android-NDBC/ndbc/~/android-sdks/tools
/source.properties -> [Help 1]

我正在使用 maven 3.2.1

这是我的 POM:

<dependencies>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.1.1.4</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
<build>
    <finalName>ndbc</finalName>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.9.0-rc.2</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>19</platform>
                </sdk>
                                </configuration>
        </plugin>
    </plugins>
</build>

我相信我的所有环境变量都设置正确:

export ANDROID_SDK_HOME=/home/michel/android-sdks
export ANDROID_HOME=/home/michel/android-sdks
export PATH="$PATH:~/android-sdks/tools"
export PATH="$PATH:~/android-sdks/platform-tools"

当我运行 mvn install OR mvn android:apk 我得到同样的错误。

奇怪的是,当我在 eclipse 中运行它时,我得到了同样的错误,但如果我通过 AVM 运行它,它工作正常,实际上只是构建似乎是问题的 apk。

有什么想法吗?

【问题讨论】:

标签: android eclipse maven android-maven-plugin


【解决方案1】:

Sasikumar M 的路径正确..(双关语)

由于某种原因,android-maven-plugin 没有选择 ANDROID_HOME。在属性中设置它不起作用,但在插件中设置它可以。在配置中设置路径。这是 POM 片段。

            <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <configuration>
                <sdk>
                    <path>/home/michel/android-sdks</path>
                    <platform>19</platform>
                </sdk>
            </configuration>
        </plugin>

【讨论】:

    【解决方案2】:

    我发现在运行 maven 时设置路径最适合我,方法是在调用目标之前添加以下内容:-Dandroid.sdk.path=

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-29
      • 1970-01-01
      • 2017-07-09
      • 2018-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多