我正在尝试在云中设置一些 android 自动化(具体为 Docker)。
这是我的码头文件:
ENV DEBIAN_FRONTEND noninteractive
RUN echo "debconf shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
echo "debconf shared/accepted-oracle-license-v1-1 seen true" | debconf-set-selections
# Update packages
RUN dpkg --add-architecture i386 &&\
apt-get -yqq update && \
apt-get install -qqy \
software-properties-common\
curl \
html2text \
libc6-i386 \
lib32stdc++6 \
lib32gcc1 \
lib32ncurses5 \
bzip2 \
lib32z1 \
unzip \
wget \
build-essential \
expect \
file \
libmagic1 \
python-pip && \
add-apt-repository ppa:webupd8team/java && \
apt-get -yqq update && \
apt-get -yqq install oracle-java8-installer && \
rm -rf /var/lib/apt/lists/*
RUN python -m pip install --upgrade pip
# Install android sdk
RUN wget -q -O /tmp/sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-3952940.zip \
&& unzip -q /tmp/sdk.zip -d /usr/local/android-sdk \
&& rm /tmp/sdk.zip \
&& chown -R root:root /usr/local/android-sdk/
# Add android tools and platform tools to PATH
ENV ANDROID_HOME /usr/local/android-sdk
ENV PATH $PATH:$ANDROID_HOME/tools
ENV PATH $PATH:$ANDROID_HOME/tools/bin
ENV PATH $PATH:$ANDROID_HOME/platform-tools
ENV PATH $PATH:$ANDROID_HOME/platform-tools/bin
# AMULATOR NEEDS THIS ENV
ENV ANDROID_SDK_ROOT $ANDROID_HOME
ENV QEMU_AUDIO_DRV none
# Export JAVA_HOME variable
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
## accept license
RUN mkdir -p $ANDROID_HOME/licenses
RUN echo '8933bad161af4178b1185d1a37fbf41ea5269c55' > $ANDROID_HOME/licenses/android-sdk-license
RUN sdkmanager --update
RUN sdkmanager 'platform-tools'
RUN sdkmanager 'tools'
RUN sdkmanager 'platforms;android-22'
RUN sdkmanager 'lldb;2.3'
RUN sdkmanager 'emulator'
RUN sdkmanager 'build-tools;22.0.1'
# Extras
RUN sdkmanager 'extras;android;m2repository'
RUN sdkmanager 'extras;google;m2repository'
RUN sdkmanager 'extras;google;google_play_services'
RUN sdkmanager 'extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2'
RUN sdkmanager 'extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1'
RUN sdkmanager 'add-ons;addon-google_apis-google-22'
# RUN sdkmanager 'system-images;android-22;google_apis_playstore;x86'
# No KVM required image
RUN sdkmanager 'system-images;android-22;google_apis;armeabi-v7a'
RUN sdkmanager 'system-images;android-22;default;armeabi-v7a'
# Create fake keymap file
RUN mkdir /usr/local/android-sdk/tools/keymaps && \
touch /usr/local/android-sdk/tools/keymaps/en-us
# EMULATOR
RUN DEBIAN_FRONTEND=noninteractive apt-get -yqq update && apt-get install -y libqt5widgets5
ENV QT_QPA_PLATFORM offscreen
ENV LD_LIBRARY_PATH ${ANDROID_HOME}/emulator/lib64/qt/lib/
我使用以下命令创建 avd:
avdmanager create avd --name avdtest --force --package 'system-images;android-24;google_apis;armeabi-v7a' --abi 'google_apis/armeabi-v7a' --tag 'google_apis'
使用以下命令运行模拟器:
/emulator/emulator -avd avdtest -writable-system -engine classic -no-window -camera-back none -camera-front none -debug all -qemu -m 512
使用此设置我无法运行 avd 得到错误:
I/DEBUG ( 61): Build fingerprint: 'Android/sdk_google_phone_armv7/generic:5.1.1/LMY48X/4088218:userdebug/test-keys'
I/DEBUG ( 61): Revision: '0'
I/DEBUG ( 61): ABI: 'arm'
I/DEBUG ( 61): pid: 1844, tid: 1844, name: surfaceflinger >>> /system/bin/surfaceflinger <<<
I/DEBUG ( 61): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
I/DEBUG ( 61): r0 00000000 r1 00000734 r2 00000006 r3 00000000
I/DEBUG ( 61): r4 b6f5ce38 r5 00000006 r6 00000002 r7 0000010c
I/DEBUG ( 61): r8 ffffffc4 r9 b648d158 sl 00000000 fp bebc4b7c
I/DEBUG ( 61): ip 00000734 sp bebc4998 lr b6eb9745 pc b6edc950 cpsr 60000010
I/DEBUG ( 61):
I/DEBUG ( 61): backtrace:
I/DEBUG ( 61): #00 pc 00039950 /system/lib/libc.so (tgkill+12)
I/DEBUG ( 61): #01 pc 00016741 /system/lib/libc.so (pthread_kill+52)
I/DEBUG ( 61): #02 pc 0001735f /system/lib/libc.so (raise+10)
I/DEBUG ( 61): #03 pc 00013b39 /system/lib/libc.so (__libc_android_abort+36)
I/DEBUG ( 61): #04 pc 00012f18 /system/lib/libc.so (abort+4)
I/DEBUG ( 61): #05 pc 000214ff /system/lib/libsurfaceflinger.so
I/DEBUG ( 61): #06 pc 00017841 /system/lib/libsurfaceflinger.so (android::SurfaceFlinger::init()+104)
I/DEBUG ( 61): #07 pc 00000af1 /system/bin/surfaceflinger
I/DEBUG ( 61): #08 pc 00012dc9 /system/lib/libc.so (__libc_init+44)
I/DEBUG ( 61): #09 pc 00000c08 /system/bin/surfaceflinger
I/DEBUG ( 61):
I/DEBUG ( 61): Tombstone written to: /data/tombstones/tombstone_07