Could not create Android emulator: Failed to parse

2019-02-14 04:04发布

Headless Linux 64-bit. Jenkins is trying to create android emulator but fails with these settings:

[android] Using Android SDK: /opt/android-sdk-linux
[android] Creating Android AVD: /var/lib/jenkins/.android/avd/hudson_en-US_120_768x1200_Google_Inc._Google_APIs_23_google_apis-x86.avd
[android] /opt/android-sdk-linux/tools/android create avd -f -a -s 768x1200 -n hudson_en-US_120_768x1200_Google_Inc._Google_APIs_23_google_apis-x86 -t "Google Inc.:Google APIs:23" --abi google_apis/x86_64
[android] Could not create Android emulator: Failed to parse AVD config file

Also tried other ABI's for same device: armeabi_v7 and google_apis/x86

I am trying to create this device like that because I need Google Play Services. I was able to create and run emulator with following settings:

[android] Using Android SDK: /opt/android-sdk-linux
[android] /opt/android-sdk-linux/tools/android create avd -f -a -s 768x1200 -n hudson_en-US_120_768x1200_android-23_armeabi-v7a -t android-23 --abi armeabi-v7a
[android] Creating Android AVD: /var/lib/jenkins/.android/avd/hudson_en-US_120_768x1200_Google_Inc._Google_APIs_23_google_apis-x86.avd
[android] Starting Android emulator
$ /opt/android-sdk-linux/tools/emulator -engine classic -ports 5730,5731 -report-console tcp:5847,max=60 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_120_768x1200_android-23_armeabi-v7a -no-snapshot-load -no-snapshot-save -no-window
[android] Emulator reported that the startup process is 'running'

But this emulator doesn't support Google Play services (Google Maps to be more specific), so I don't want it.

2条回答
乱世女痞
2楼-- · 2019-02-14 04:46

I had faced the similar problem in Mac book pro 13", macOS Sierra; version 10.12.3. I deleted the system environment variables for location to android sdk & gradle previously which I added. When I built it with system environment variables; Jenkins downloaded the sdk & it run without failure.

You can also refer to the book Expert Android Studio by Murat Yener, Onur Dundar chapter 10 : Continuous integration; where they showed how to build on Jenkins.

查看更多
在下西门庆
3楼-- · 2019-02-14 05:00

I found temporary workaround for that:

Create that same device locally (I did it on my personal laptop, a MAC) with Android AVD manager. Then copy this newly created device to Linux server /var/lib/jenkins/.android/avd/ folder (.ini and .avd folder).

And it worked, also Google Maps is supported.

查看更多
登录 后发表回答