android maven plugin does not get ANDROID_HOME env variable in Eclipse

前端 未结 9 2235
[愿得一人]
[愿得一人] 2021-02-20 11:23

i\'m working on an Android app project and it is a Maven project. when i try to run as \"maven install\" this is what i get:

\"Failed to execute goal com.jayway.maven.pl

9条回答
  •  遇见更好的自我
    2021-02-20 12:03

    From the documentation

    You may configure it in the android-maven-plugin configuration section in the pom.xml file using ... or ... or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME.

    Solution 1

    I have defined an Android SDK system variable called ANDROID_SDK (instead of ANDROID_HOME) and referenced it in my pom.xml this way:

      ...
      ...
      ...
      apk
      ...
      ...
    
      
        ${env.ANDROID_SDK}
        ...
      
    

    Solution 2

    As an alternative you can also configure it in the android-maven-plugin section:

    
    true
    com.jayway.maven.plugins.android.generation2
    android-maven-plugin
    ${android-maven-plugin.version}
    
      ${project.basedir}/AndroidManifest.xml
      ${project.basedir}/assets
      ${project.basedir}/res
      ${project.basedir}/src/main/native
      
        ${env.ANDROID_SDK}
        16
      
      true
    
    
    

    Solution 3

    As a third option you can set the SDK from the command line passing an argument to Maven:

    mvn clean install -Dandroid.sdk.path="C:\\Program Files (x86)\\Android\\android-sdk"

提交回复
热议问题