当前位置: 首页 > 面试题库 >

jenkins-maven-android运行时抛出错误“ android-sdk-linux / platforms”不是目录”

轩辕阳焱
2023-03-14
问题内容

我开始设置jenkins-maven-android,并且在运行jenkin作业时遇到问题

目标com.jayway.maven.plugins.android.generation2的执行default-generate-
sources:android-maven-plugin:3.1.1:generate-sources失败:路径“ / opt / android-sdk-
linux / platforms”不是目录。请提供正确的Android SDK目录路径作为配置参数

请帮助我解决此问题。

我的机器详细信息$ uname -a

Linux开发2 3.0.0-12-虚拟#20-Ubuntu SMP Fri Oct 7 18:19:02 UTC 2011 x86_64 x86_64
x86_64 GNU / Linux

我已经在〜/ .bashrc中设置了ENV变量

#JAVA_HOME 
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk 
export PATH=$JAVA_HOME:$PATH

#Android PATH 
export ANDROID_HOME=/opt/android-sdk-linux 
export PATH=$ANDROID_HOME:$PATH
export PATH=${PATH}:$ANDROID_HOME/tools export
PATH=${PATH}:$ANDROID_HOME/platform-tools

#Apache Maven 
export M2_HOME=/opt/apache-maven-3.0.4 
export M2=$M2_HOME/bin 
export MAVEN_OPTS="-Xms256m -Xmx512m" 
export PATH=$M2:$PATH

 root@development2:~# mvn -version

Apache Maven 3.0.4 (r1232337;2012-01-17 08:44:56+0000) 
Maven home: /opt/apache-maven-3.0.4 
Java version: 1.6.0_24, vendor: Sun Microsystems Inc. 
Java home:/usr/lib/jvm/java-6-openjdk/jre 
Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.0.0-12-virtual", arch:
 "amd64", family: "unix"

Jenkins中的堆栈跟踪:

 mavenExecutionResult exceptions not empty message : Failed to execute
 goal
 com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources
 (default-generate-sources) on project base-template: Execution
 default-generate-sources of goal
 com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources
 failed: Path "/opt/android-sdk-linux/platforms" is not a directory.
 Please provide a proper Android SDK directory path as configuration
 parameter <sdk<path...</path</sdk in the plugin <configuration/.
 As an alternative, you may add the parameter to commandline:
 -Dandroid.sdk.path=... or set environment variable ANDROID_HOME. cause : Execution default-generate-sources of goal
 com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources
 failed: Path "/opt/android-sdk-linux/platforms" is not a directory.
 Please provide a proper Android SDK directory path as configuration
 parameter <sdk<path...</path</sdk in the plugin <configuration/.
 As an alternative, you may add the parameter to commandline:
 -Dandroid.sdk.path=... or set environment variable ANDROID_HOME. Stack trace :  org.apache.maven.lifecycle.LifecycleExecutionException:
 Failed to execute goal
 com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources
 (default-generate-sources) on project base-template: Execution
 default-generate-sources of goal
 com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources
 failed: Path "/opt/android-sdk-linux/platforms" is not a directory.
 Please provide a proper Android SDK directory path as configuration
 parameter <sdk<path...</path</sdk in the plugin <configuration/.
 As an alternative, you may add the parameter to commandline:
 -Dandroid.sdk.path=... or set environment variable ANDROID_HOME.   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
    at
 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at
 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at
 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at
 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at
 org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at
 org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)   at
 org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)   at
 org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)     at
 org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    at
 org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at
 org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:98)   at
 hudson.maven.Maven3Builder.call(Maven3Builder.java:64)     at
 hudson.remoting.UserRequest.perform(UserRequest.java:118)  at
 hudson.remoting.UserRequest.perform(UserRequest.java:48)   at
 hudson.remoting.Request$2.run(Request.java:326)    at
 hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)     at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679) Caused by:
 org.apache.maven.plugin.PluginExecutionException: Execution
 default-generate-sources of goal
 com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources
 failed: Path "/opt/android-sdk-linux/platforms" is not a directory.
 Please provide a proper Android SDK directory path as configuration
 parameter <sdk<path...</path</sdk in the plugin <configuration/.
 As an alternative, you may add the parameter to commandline:
 -Dandroid.sdk.path=... or set environment variable ANDROID_HOME.   at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
    at
 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 27 more Caused by:
 com.jayway.maven.plugins.android.InvalidSdkException: Path
 "/opt/android-sdk-linux/platforms" is not a directory. Please provide
 a proper Android SDK directory path as configuration parameter
 <sdk<path...</path</sdk in the plugin <configuration/. As an
 alternative, you may add the parameter to commandline:
 -Dandroid.sdk.path=... or set environment variable ANDROID_HOME.   at com.jayway.maven.plugins.android.AndroidSdk.assertPathIsDirectory(AndroidSdk.java:125)
    at
 com.jayway.maven.plugins.android.AndroidSdk.getPlatformDirectories(AndroidSdk.java:285)
    at
 com.jayway.maven.plugins.android.AndroidSdk.findAvailablePlatforms(AndroidSdk.java:260)
    at
 com.jayway.maven.plugins.android.AndroidSdk.<init(AndroidSdk.java:80)
    at
 com.jayway.maven.plugins.android.AbstractAndroidMojo.getAndroidSdk(AbstractAndroidMojo.java:844)
    at
 com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:329)
    at
 com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:102)
    at
 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    ... 28 more channel stopped Finished: FAILURE

问题答案:

您似乎对Android SDK路径没有正确的权限。请检查哪个用户正在运行Jenkins。尝试’ps -ef’检查用户。

从该用户登录并尝试访问Android SDK文件夹。

如果您没有访问权限,请提供相对许可Android SDK路径。



 类似资料:
  • 刚才我已经安装并开始在Android Studio上工作,并在配置了开始工作所需的一切后创建了新项目。在新创建的项目中,我没有更改任何内容,然后尝试运行该项目。但是它不起作用,我想会出现一些依赖错误。这就是它。 > 出错的地方:发现任务': StudioTest2:'的配置有问题。 为属性“dex文件”指定的文件“C:\Users\StudioTest2\build\libs\StudioTest

  • 下面是我的Gridle文件,我尝试了stackoverflow other的问题answare中所有可能的解决方案,但仍然显示相同的结果。 错误: 错误:(3)错误检索项目的父:没有找到与给定名称'android: Text外观匹配的资源。材料。小部件。按钮。无国界。有色'。 网格: 这里是使用XML的地方: 将minsdkversion更改为11时出现其他一些错误 错误:任务“:app:proc

  • 我已经完成了Eclipse Maven TestNG,我打算运行Selenium测试用例。 这是我的POM文件: 现在,当我尝试运行Maven测试时,我得到以下错误: 有人能告诉我我错过了什么吗。 提前谢谢。

  • 我试图将我的android项目连接到php上的数据库,我的代码中没有错误,但当我试图在手机上运行我的应用程序时,它不起作用 这就是Json_解析 我知道,这是我在日志中的错误 e/ViewRootImpl: sendUserAction事件()mView==null

  • 'tools.jar'不在Android Studio类路径中。请确保JAVA_HOME指向JDK而不是JRE 这里有人能帮我吗?

  • 嘿,伙计们,我试图ru我的模拟器,但当我运行它,它给我这个错误: “安装下列Android SDK包失败,因为某些许可证尚未被接受。构建-工具;30.0.2 Android SDK构建-工具30.0.2若要构建此项目,请接受SDK许可协议并使用Android Studio SDK管理器安装缺少的组件。或者,若要将许可协议从一个工作站转移到另一个工作站,请参见http://d.Android.com