由于Android ADK许可问题,Jenkins作业失败

时间:2019-03-14 10:20:59

标签: android jenkins continuous-integration

当我尝试在jenkins上运行android项目时,出现此错误。这并非每次都发生。 50%的时间在发生。

任何帮助将不胜感激


   build-tools;28.0.3 Android SDK Build-Tools 28.0.3

   platforms;android-28 Android SDK Platform 28

To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.

Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html



Using Android SDK: /opt/android-sdk

    at com.android.build.gradle.internal.SdkHandler.initTarget(SdkHandler.java:194)

    at com.android.build.gradle.BasePlugin.ensureTargetSetup(BasePlugin.java:960)

    at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:732)

    at com.android.build.gradle.BasePlugin.lambda$null$4(BasePlugin.java:670)

    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)

    at com.android.build.gradle.BasePlugin.lambda$createTasks$5(BasePlugin.java:666)

    at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)

    at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)

    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)

    at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)

    at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)

    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)

    at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)

    at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)

    at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)

    at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)

    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)

    at com.sun.proxy.$Proxy24.afterEvaluate(Unknown Source)

    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:76)

    ... 81 more

1 个答案:

答案 0 :(得分:0)

android SDK出现问题。当我们尝试通过命令行接受许可证时,问题仍然存在 最后,我在詹金斯的第一步中添加了以下命令。

echo y | sudo /opt/android-sdk/tools/bin/sdkmanager "build-tools;28.0.3"
echo y | sudo /opt/android-sdk/tools/bin/sdkmanager "platforms;android-28"

然后它起作用了。我第一次执行工作时,它接受了许可证。我删除了命令并运行了它。现在一切正常