Maven Android错误读取文件source.properties [英] maven android error reading file source.properties

查看:46
本文介绍了Maven Android错误读取文件source.properties的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

 无法执行目标com.jayway.maven.plugins.android.generation2:android-maven-插件:3.9.0-rc.2:项目ndbc上的generate-sources(default-generate-sources):执行目标的默认生成源com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.2:generate-来源失败:读取/storage/code/android-NDBC/ndbc/〜/android-sdks/tools时出错/source.properties->[帮助1] 

我正在使用Maven 3.2.1

这是我的POM:

 < dependencies><依赖关系>< groupId> com.google.android</groupId>< artifactId> android</artifactId>< version> 4.1.1.4</version>< scope>提供的</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><配置>< sdk>< platform> 19</platform></sdk></configuration></plugin></plugins></build> 

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

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

当我运行mvn install或mvn android:apk时,出现相同的错误.

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

有什么想法吗?

解决方案

Sasikumar M具有正确的路径.

由于某些原因,android-maven-plugin无法启动ANDROID_HOME.在属性中设置它不起作用,但是在插件中设置它却起作用.在配置中设置路径.这是POM片段.

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

I am trying to build a simple hello world android app. I am getting this error:

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]

I am using maven 3.2.1

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

I believe that I have all my environment vars set correctly:

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"

when I run mvn install OR mvn android:apk I get the same error.

What is weird is that when I run this in eclipse I get the same error, but if I run it through the AVM it works fine, just actually BUILDING the apk that seems to be the problem.

Any ideas?

解决方案

Sasikumar M had the correct path.. (pun intended)

The android-maven-plugin is not picking up the ANDROID_HOME for some reason. Setting it in the properties did not work, but setting it in the plugin did. Set the path in the configuration. Here is POM fragment.

            <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>

这篇关于Maven Android错误读取文件source.properties的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆