[英]“Invalid --abi armeabi-v7a for the selected target” with Google APIs
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.我正在尝试将 Android 项目从使用 API Level 19 SDK 和构建工具更新到最新的 API Level 21,包括 Google API。 Everything was running fine on Travis prior to this update (for example, see this build ).在此更新之前,Travis 上的一切运行良好(例如,请参阅此版本)。
When I run with the new API level I see the following error:当我使用新的 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
See this build for the full Travis output.有关完整的 Travis 输出,请参阅此版本。
Here's my .travis.yml:这是我的 .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 .我的 build.gradle 在这里。
Again, the only thing I changed in the new Travis build is the API level and build tools level.同样,我在新的 Travis 构建中唯一改变的是 API 级别和构建工具级别。
Apparently the names of the Google APIs system images and ABI parameters changed:显然,Google API 系统映像和 ABI 参数的名称已更改:
armeabi-v7a
to google_apis/armeabi-v7a
ABI = armeabi-v7a
到google_apis/armeabi-v7a
sys-img-armeabi-v7a-android-21
to sys-img-armeabi-v7a-addon-google_apis-google-21
系统映像 = sys-img-armeabi-v7a-android-21
到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
变量和组件名称来解决此问题 - 新值是:
- 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编辑 2016 年 9 月 12 日
Apparently there was another change in mid-2016 that causes this same problem.显然,2016 年年中还有另一个变化导致了同样的问题。 For example, here's a failed build with the same error message.例如, 这是一个带有相同错误消息的失败构建。
The following changes were needed to fix Travis builds:需要进行以下更改来修复 Travis 构建:
ANDOID_TAG ABI
tag variable添加单独的ANDOID_TAG ABI
标签变量repository-11.xml
and to install Android SDK tools 25.1.x复制工具以获取新的repository-11.xml
并安装 Android SDK 工具 25.1.xFor example:例如:
- ANDROID_ABI=google_apis/armeabi-v7a
...changed to: ...变成:
- ANDROID_ABI=armeabi-v7a
- ANDROID_TAG=google_apis
- tools
needs to be listed twice. - tools
需要列出两次。
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.请参阅此提交以获取需要更改的更改集, 此文件以获取完整工作的脚本,并查看https://github.com/travis-ci/travis-ci/issues/6122#issuecomment-239073557了解详细信息。
Thanks to @Ardock for the fixes!感谢@Ardock 的修复!
EDIT Nov 28th, 2016编辑 2016 年 11 月 28 日
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.
我似乎 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.
For more details see https://github.com/OneBusAway/onebusaway-android/issues/720 .有关更多详细信息,请参阅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.此外,显然 ARM ABI 目前不适用于 API 级别 24 或 25(Android 7.1.1) - 请参阅此问题以获取 SDK 管理器的屏幕截图。
Posted issue to Android Studio Google+ Community here:https://plus.google.com/+SeanBarbeau/posts/adNGGtJFhvi?sfc=true在此处向 Android Studio Google+ 社区发布问题:https ://plus.google.com/+SeanBarbeau/posts/adNGGtJFhvi?sfc=true
A little late to the party but this still remains an issue and the only way I have found around it is by using android-22
on the emulator.聚会有点晚了,但这仍然是一个问题,我找到的唯一方法是在模拟器上使用android-22
。
This is my .travis.yml
for reference.这是我的.travis.yml
供参考。
language: android
notifications:
email: false
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y pax
env:
global:
- ANDROID_API_LEVEL=26
- ANDROID_BUILD_TOOLS_VERSION=26.0.1
- ANDROID_EMU_API_LEVEL=22
- ANDROID_ABI=armeabi-v7a
- ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default)
- QEMU_AUDIO_DRV=none # Remove audio
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
android:
components:
- tools
- platform-tools
- tools
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
- android-$ANDROID_API_LEVEL
- android-$ANDROID_EMU_API_LEVEL
- extra-android-support
- sys-img-$ANDROID_ABI-google_apis-$ANDROID_EMU_API_LEVEL
before_script:
- echo -e "Host github.com\n\tHostName github.com\n\tUser git\n\tIdentityFile ~/.ssh/id_travisci\n" >> ~/.ssh/config
- echo no | android create avd --force -n test -t android-$ANDROID_EMU_API_LEVEL --abi google_apis/$ANDROID_ABI
- emulator -avd test -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- ./gradlew clean installDebug
- ./gradlew check
- ./gradlew testDebugUnitTest
- ./gradlew connectedDebugAndroidTest
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.