“对于所选目标无效--abi armeabi-v7a"使用Google API [英] "Invalid --abi armeabi-v7a for the selected target" with Google APIs

查看:79
本文介绍了“对于所选目标无效--abi armeabi-v7a"使用Google API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从使用API​​ Level 19 SDK升级Android项目,并将工具构建到最新的API Level 21,包括Google API.在此更新之前,Travis上的一切运行正常(例如,请参见此版本).

使用新的API级别运行时,看到以下错误:

0.42s$ echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$ANDROID_API_LEVEL --abi $ANDROID_ABI
Valid ABIs: no ABIs.
Error: Invalid --abi armeabi-v7a for the selected target.
The command "echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$ANDROID_API_LEVEL --abi $ANDROID_ABI" failed and exited with 1

有关完整的Travis输出,请参见此版本.

>

这是我的.travis.yml:

language: android
jdk: oraclejdk7
# Turn off caching to avoid any caching problems
cache: false
# Use the Travis Container-Based Infrastructure (see #203)
sudo: false
env:
  global:
    - ANDROID_API_LEVEL=21
    - ANDROID_BUILD_TOOLS_VERSION=21.1.2
    - ANDROID_ABI=armeabi-v7a

android:
  components:
    - platform-tools
    - tools
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_BUILD_TOOLS_VERSION
    # For Google Maps API v1
    - addon-google_apis-google-$ANDROID_API_LEVEL
    # Google Play Services
    - extra-google-google_play_services
    # Support library
    - extra-android-support
    # Latest artifacts in local repository
    - extra-google-m2repository
    - extra-android-m2repository
    # Specify at least one system image,
    - sys-img-armeabi-v7a-android-$ANDROID_BUILD_TOOLS_VERSION

before_script:
  # Create and start emulator
  - echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$ANDROID_API_LEVEL --abi $ANDROID_ABI
  - emulator -avd test -no-skin -no-audio -no-window &

script:
  - ./wait_for_emulator
  - ./gradlew connectedCheck -PdisablePreDex

我的build.gradle是此处.

同样,在新的Travis构建中,我唯一更改的是API级别和构建工具级别.

解决方案

显然,Google API系统映像的名称和ABI参数已更改:

  • ABI = armeabi-v7agoogle_apis/armeabi-v7a
  • 系统映像= sys-img-armeabi-v7a-android-21sys-img-armeabi-v7a-addon-google_apis-google-21

我通过更新我的ANDROID_ABI变量和系统映像的组件名称来解决此问题-新值是:

- ANDROID_ABI=google_apis/armeabi-v7a
...
# Specify at least one system image,
- sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL

这是上下文中的整个部分:

env:
  global:
    - ANDROID_API_LEVEL=21
    - ANDROID_BUILD_TOOLS_VERSION=21.1.2
    - ANDROID_ABI=google_apis/armeabi-v7a

android:
  components:
    - platform-tools
    - tools
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_API_LEVEL
    # For Google Maps API v1
    - addon-google_apis-google-$ANDROID_API_LEVEL
    # Google Play Services
    - extra-google-google_play_services
    # Support library
    - extra-android-support
    # Latest artifacts in local repository
    - extra-google-m2repository
    - extra-android-m2repository
    # Specify at least one system image
    - sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL

这些更改之后,它构建成功.

EDIT 2016年9月12日

很明显,2016年中发生了另一个变化,导致了同样的问题.例如,这里的构建失败,并带有相同的错误消息.

需要以下更改来修复Travis构建:

  • 添加单独的ANDOID_TAG ABI标签变量
  • 复制工具以获取新的repository-11.xml并安装Android SDK工具25.1.x
  • 更改系统映像名称以匹配新的Android SDK
  • 更改模拟器启动命令以使用新的ABI标签变量来指定Google API

例如:

- ANDROID_ABI=google_apis/armeabi-v7a

...更改为:

- ANDROID_ABI=armeabi-v7a

- ANDROID_TAG=google_apis

- tools需要列出两次.

系统映像:

- sys-img-armeabi-v7a-addon-google_apis-google-23

- sys-img-armeabi-v7a-addon-google_apis-google-23

...需要更改为:

- sys-img-armeabi-v7a-google_apis-23

- sys-img-armeabi-v7a-google_apis-23

启动仿真器的行从:

- echo no | android create avd --force -n test -t "Google Inc.:Google APIs:23" --abi $ANDROID_ABI

...发送至:

- echo no | android create avd --force -n test -t "android-23" --abi $ANDROID_ABI --tag $ANDROID_TAG

有关更改集,请参见此提交需要更改,此文件以获取完整的信息工作脚本,请参见 https://github.com/travis- ci/travis-ci/issues/6122#issuecomment-239073557 了解详情.

感谢@Ardock提供修复程序!

EDIT 2016年11月28日

我似乎API级别23模拟器当前不能在Travis上使用上述功能-android create avd --force -n test -t "android-23" --abi "armeabi-v7a" --tag "google_apis"产生错误Error: Invalid --tag google_apis for the selected target.有关更多详细信息,请参见 https://plus.google.com/+SeanBarbeau/posts/adNGGtJFhvi?sfc = true

I'm trying to update an Android project from using the API Level 19 SDK and build tools to the newest API Level 21, including the Google APIs. Everything was running fine on Travis prior to this update (for example, see this build).

When I run with the new API level I see the following error:

0.42s$ echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$ANDROID_API_LEVEL --abi $ANDROID_ABI
Valid ABIs: no ABIs.
Error: Invalid --abi armeabi-v7a for the selected target.
The command "echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$ANDROID_API_LEVEL --abi $ANDROID_ABI" failed and exited with 1

See this build for the full Travis output.

Here's my .travis.yml:

language: android
jdk: oraclejdk7
# Turn off caching to avoid any caching problems
cache: false
# Use the Travis Container-Based Infrastructure (see #203)
sudo: false
env:
  global:
    - ANDROID_API_LEVEL=21
    - ANDROID_BUILD_TOOLS_VERSION=21.1.2
    - ANDROID_ABI=armeabi-v7a

android:
  components:
    - platform-tools
    - tools
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_BUILD_TOOLS_VERSION
    # For Google Maps API v1
    - addon-google_apis-google-$ANDROID_API_LEVEL
    # Google Play Services
    - extra-google-google_play_services
    # Support library
    - extra-android-support
    # Latest artifacts in local repository
    - extra-google-m2repository
    - extra-android-m2repository
    # Specify at least one system image,
    - sys-img-armeabi-v7a-android-$ANDROID_BUILD_TOOLS_VERSION

before_script:
  # Create and start emulator
  - echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$ANDROID_API_LEVEL --abi $ANDROID_ABI
  - emulator -avd test -no-skin -no-audio -no-window &

script:
  - ./wait_for_emulator
  - ./gradlew connectedCheck -PdisablePreDex

My build.gradle is here.

Again, the only thing I changed in the new Travis build is the API level and build tools level.

解决方案

Apparently the names of the Google APIs system images and ABI parameters changed:

  • ABI = armeabi-v7a to google_apis/armeabi-v7a
  • System image = sys-img-armeabi-v7a-android-21 to sys-img-armeabi-v7a-addon-google_apis-google-21

I fixed this by updating both my ANDROID_ABI variable and component name for the system image - new values are:

- ANDROID_ABI=google_apis/armeabi-v7a
...
# Specify at least one system image,
- sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL

Here's the whole section in context:

env:
  global:
    - ANDROID_API_LEVEL=21
    - ANDROID_BUILD_TOOLS_VERSION=21.1.2
    - ANDROID_ABI=google_apis/armeabi-v7a

android:
  components:
    - platform-tools
    - tools
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_API_LEVEL
    # For Google Maps API v1
    - addon-google_apis-google-$ANDROID_API_LEVEL
    # Google Play Services
    - extra-google-google_play_services
    # Support library
    - extra-android-support
    # Latest artifacts in local repository
    - extra-google-m2repository
    - extra-android-m2repository
    # Specify at least one system image
    - sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL

After these changes, it builds successfully.

EDIT Sept 12th, 2016

Apparently there was another change in mid-2016 that causes this same problem. For example, here's a failed build with the same error message.

The following changes were needed to fix Travis builds:

  • Add separate ANDOID_TAG ABI tag variable
  • Duplicate tools to get the new repository-11.xml and to install Android SDK tools 25.1.x
  • Change system image names to match new Android SDK
  • Change emulator start command to use new ABI tag variable to specify Google APIs

For example:

- ANDROID_ABI=google_apis/armeabi-v7a

...changed to:

- ANDROID_ABI=armeabi-v7a

- ANDROID_TAG=google_apis

- tools needs to be listed twice.

The system images:

- sys-img-armeabi-v7a-addon-google_apis-google-23

- sys-img-armeabi-v7a-addon-google_apis-google-23

...needed to be changed to:

- sys-img-armeabi-v7a-google_apis-23

- sys-img-armeabi-v7a-google_apis-23

The line to start the emulator changed from:

- echo no | android create avd --force -n test -t "Google Inc.:Google APIs:23" --abi $ANDROID_ABI

...to:

- echo no | android create avd --force -n test -t "android-23" --abi $ANDROID_ABI --tag $ANDROID_TAG

See this commit for a changeset of what needs to be changed, this file for a fully working script, and see https://github.com/travis-ci/travis-ci/issues/6122#issuecomment-239073557 for details.

Thanks to @Ardock for the fixes!

EDIT Nov 28th, 2016

I seems that API Level 23 emulator is currently not working on Travis with the above - android create avd --force -n test -t "android-23" --abi "armeabi-v7a" --tag "google_apis" yields the error Error: Invalid --tag google_apis for the selected target. For more details see https://github.com/OneBusAway/onebusaway-android/issues/720.

Also, apparently ARM ABIs aren't currently available for API Level 24 or 25 (Android 7.1.1) - see this issue for a screenshot of SDK Manager.

Posted issue to Android Studio Google+ Community here: https://plus.google.com/+SeanBarbeau/posts/adNGGtJFhvi?sfc=true

这篇关于“对于所选目标无效--abi armeabi-v7a"使用Google API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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