Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android emulators are broken on trusty env update because avdmanager is not on PATH #8360

Closed
ZacSweers opened this issue Sep 7, 2017 · 13 comments

Comments

@ZacSweers
Copy link

Started happening recently and noticed it on a couple of different android repos

uber/AutoDispose#71
JakeWharton/RxBinding#404

Error is basically Error: Target id is not valid. Use 'android list targets' to get the target ids.

@isnifer
Copy link

isnifer commented Sep 7, 2017

Confirm tipsi/tipsi-stripe
All builds from the 1st of September are broken. I don't change any config.
travis

@BanzaiMan
Copy link
Contributor

What target ids are problematic?

@iriberri
Copy link

iriberri commented Sep 7, 2017

Hi @hzsweers and @isnifer, thanks for reporting this issue and sorry for the troubles.

First of all, and while we help you sort out this issue or any other related to the migration to the Android image in Trusty, you can specify dist: precise to keep your builds running in the Precise image in which they were working before.

Now, let's get to some details on the new Android image (see #5370), which was released recently.

In this update, the android tool has been deprecated in favor of sdkmanager and avdmanager.

Getting back to the specific error you're seeing, the old Android image in Precise came with the following targets preinstalled:

id: 1 or "android-10"
id: 2 or "android-15"
id: 3 or "android-16"
id: 4 or "android-17"
id: 5 or "android-18"
id: 6 or "android-19"
id: 7 or "android-20"
id: 8 or "android-21"

however, the Trusty image comes only with android-25, and other targets (such as android-21 or android-18) need to be explicitly requested in the android.components section, as well as the specific ABIs needed.

For example, I made some tests on a fork of the tipsi/tipsi-stripe repository, and the build seems to be going through this step after adding the following components:

- android-21
- sys-img-armeabi-v7a-android-21

Could you please give this a try and let us know how it goes?

Thank you!

@ZacSweers
Copy link
Author

Mind taking a look at uber/AutoDispose#79 and letting me know if you spot anything obviously wrong? I've been trying to get this working but without avail (see the recent commits on the PR for various attempts)

@ZacSweers
Copy link
Author

So it seems the crux of the issue is that the avdmanager binary is not getting installed, and subsequently any UI tests requiring an emulator won't work

@ZacSweers ZacSweers changed the title Android emulators support seems to be broken? Error: Target id is not valid. Use 'android list targets' to get the target ids. Android emulators are broken on trusty env update because avdmanager is not on PATH Sep 10, 2017
@ZacSweers
Copy link
Author

I've renamed this to be more accurate. Hope travis-ci can look into it soon as it seems to block any project using emulators :/

@isnifer
Copy link

isnifer commented Sep 11, 2017

@iriberri my problem is solved, thank you)

@BanzaiMan
Copy link
Contributor

@hzsweers How about you? Is @iriberri's suggestions helpful for you?

@ZacSweers
Copy link
Author

Unfortunately not, if you look at my linked PR you'll see that was one of the things I tried in my iterations

@BanzaiMan
Copy link
Contributor

It is not hard to get avdmanager on $PATH using the tools at your disposal; specifically, by using sdkmanager.

As I mentioned in #8155 (comment), we should eventually move to sdkmanager to manage installed components. I have a primitive working example, but it is not anywhere close to production use. I'll have to work on this a little bit before presenting as a possible replacement going forward.

So, what does that leave you now?

If you need avdmanager NOW and @iriberri's suggestion does not work, you can try the following:

env:
  global:
    - ANDROID_SDK_ROOT=/opt/android  # any place `travis` can write to should work
before_install:
  - mkdir -p $ANDROID_SDK_ROOT
  # tailor the following list to your needs; `yes` below means accepting licenses.
  - yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT "tools" "build-tools;26.0.1" "extras;android;m2repository"
  - export PATH=${ANDROID_SDK_ROOT}/tools/bin:$PATH

avdmanager would be in ${ANDROID_SDK_ROOT}/tools/bin.

@isnifer
Copy link

isnifer commented Sep 13, 2017

@hzsweers hey, also you can create new installation config based on our tipsi-stripe config. Look into .travis folder and .travis.yml of course

@ZacSweers
Copy link
Author

That didn't work for me either. What did work for me was to actually install the tools manually, as in JakeWharton/butterknife#1055

Does travis maintain updated example projects and docs when updating images?

cheungpat added a commit to cheungpat/skygear-SDK-Android that referenced this issue Sep 26, 2017
rickmak pushed a commit to SkygearIO/skygear-SDK-Android that referenced this issue Sep 27, 2017
indication pushed a commit to indication/OpenRedmine that referenced this issue Oct 12, 2017
indication pushed a commit to indication/OpenRedmine that referenced this issue Oct 13, 2017
indication pushed a commit to indication/OpenRedmine that referenced this issue Oct 13, 2017
@stale
Copy link

stale bot commented Apr 13, 2018

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please do feel free to either reopen this issue or open a new one. We'll gladly take a look again! You can read more here: https://blog.travis-ci.com/2018-03-09-closing-old-issues

@stale stale bot added the stale label Apr 13, 2018
@stale stale bot closed this as completed Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants