I have a android application on github account. I want to checkout that project and create its apk through gradle and generate its apk on windows .And then run that apk on emulator. All these things I want to do through script using dockerfile so that it creates an image.
This is my dockerfile
FROM java:8
ENV DEBIAN_FRONTEND noninteractive
# Dependencies
RUN dpkg --add-architecture i386 && apt-get update && apt-get install -yq libsdl1.2debian:i386 zlib1g:i386 libncurses5:i386 ant maven --no-install-recommends
ENV GRADLE_URL http://services.gradle.org/distributions/gradle-2.2.1-all.zip
RUN curl -L ${GRADLE_URL} -o /tmp/gradle-2.2.1-all.zip && unzip /tmp/gradle-2.2.1-all.zip -d /usr/local && rm /tmp/gradle-2.2.1-all.zip
ENV GRADLE_HOME /usr/local/gradle-2.2.1
# Download and untar SDK
ENV ANDROID_SDK_URL http://dl.google.com/android/android-sdk_r24.1.2-linux.tgz
RUN curl -L "${ANDROID_SDK_URL}" | tar --no-same-owner -xz -C /usr/local
ENV ANDROID_HOME /usr/local/android-sdk-linux
ENV ANDROID_SDK /usr/local/android-sdk-linux
ENV PATH ${ANDROID_HOME}/tools:$ANDROID_HOME/platform-tools:$PATH
# Install Android SDK components
ENV ANDROID_SDK_COMPONENTS tools,platform-tools,android-22,build-tools-22.0.1,sys-img-armeabi-v7a-android-22,extra-android-m2repository,extra-google-m2repository
RUN echo y | android update sdk --no-ui --all --filter "${ANDROID_SDK_COMPONENTS}" --force
# Create emulator
RUN echo "no" | android create avd \
--force \
--name test \
--target android-22 \
--abi armeabi-v7a \
--skin WVGA800 \
--sdcard 512M
CMD emulator -avd test -force-32bit
# Support Gradle
ENV TERM dumb
ENV JAVA_OPTS -Xms256m -Xmx512m
Please let me know how to do this.
答案 0 :(得分:0)
If I understand you questions what you want is:
github
for this the command is git clone --bare https://youurl.org/user/repo.git
gradlew android:installDebug android:run
Run that apk on android emulator
for this the command is, from your SDK's tools/ directory
, install the .apk on the emulator:
adb install <path_to_your_bin>.apk
adb -s emulator-path install path/to/your/app.apk
答案 1 :(得分:0)
一旦设置了仓库,您就可以使用下面的gradle命令进行构建和安装。 gradle命令比adb命令的优势在于,您可以在不同的样式和产品版本之间进行选择。有关使用gradle命令通过bash脚本进行构建,测试和部署的信息,请参见此详细的article。
./gradlew build
./gradlew assembleDebug
#Install APK on device / emulator
./gradlew installDebug