MAVEN无效SDK:平台/ API级别16不可用 [英] MAVEN Invalid SDK: Platform/API level 16 not available

查看:404
本文介绍了MAVEN无效SDK:平台/ API级别16不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的机器人工作室(视窗)工作Android的应用程序,我想创建与Maven的apklib项目。

I have a working android app on my Android Studio (windows) and I am trying to create an apklib with MAVEN for the project.

当我运行编译Maven的(3.0.5)我收到以下错误信息:

When I run compile on MAVEN (3.0.5) I get the following error message:

Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources (default-generate-sources) on project userprofile: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources failed: Invalid SDK: Platform/API level 16 not available. This command should give you all you need:
[ERROR] C:\Program Files (x86)\Android\android-studio\sdk\tools\android update sdk --no-ui --obsolete --force

我跑更新SDK,但没有运气上面的命令(它是成功的,但我一直收到上述错误)。我的SDK管理器显示16 API的安装。

I run the above command for update sdk but no luck (it was successful, but I keep get the above error). My SDK Manager shows that API 16 is installed.

任何想法? (网络上的所有问题的结论对SDK管理器:(安装API)

Any ideas? (all questions on web conclude to install the API on SDK Manager :( )

推荐答案

---编辑---

还有一个错误,因为我有我的settings.xml设置为不正确的Andr​​oid SDK主路径。我更新了我的〜/ .m2目录/ settings.xml文件到正确的SDK路径,并把我的$ ANDROID_HOME变量,以正确的路径,这是固定的。

There was also an error because I had my settings.xml set to the incorrect android SDK home path. I updated my ~/.m2/settings.xml file to the correct SDK path and set my $ANDROID_HOME variable to the correct path and this was fixed.

我能够闯过这个错误有以下变化:

I was able to get past this error with the following changes:

  1. 更新到Maven 3.1.1
  2. 在我的pom.xml我改变了

 <插件>           <的groupId> com.jayway.maven.plugins.android.generation2< /的groupId>             < artifactId的> Android的行家,插件和LT; / artifactId的>               <版> 3.7.0< /版本>       < /插件>

<plugin> <groupId> com.jayway.maven.plugins.android.generation2 </groupId> <artifactId>android-maven-plugin</artifactId> <version>3.7.0</version> </plugin>

要:   &LT;插件&GT;           &LT;的groupId&GT; com.jayway.maven.plugins.android.generation2&LT; /的groupId&GT;             &LT; artifactId的&GT; Android的行家,插件和LT; / artifactId的&GT;               &LT;版&GT; 3.8.1&LT; /版本&GT;                 &lt;结构&GT;                     &LT; SDK&GT;                         &LT;平台&GT; 19&LT; /平台&GT;                     &LT; / SDK&GT;                 &LT; /结构&gt;       &LT; /插件&GT;
(注意这种变化既更新到<一个href="http://search.maven.org/#artifactdetails%7Ccom.jayway.maven.plugins.android.generation2%7Candroid-maven-plugin%7C3.8.1%7Cmaven-plugin"相对=nofollow> latests插件版本(3.8.1)并指定了SDK平台)

To: <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <version>3.8.1</version> <configuration> <sdk> <platform>19</platform> </sdk> </configuration> </plugin>
(note this change both updates to the latests plugin version (3.8.1) and specifies the platform for the sdk)

  1. 我跑 $ PATH_TO_YOUR_ANDROID_SDK / Android的更新SDK --no-UI --all --force

我删除了我的〜/ .m2目录目录

I deleted my ~/.m2 directory

我跑 MVN全新安装和一切工作

这篇关于MAVEN无效SDK:平台/ API级别16不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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