Code Monkey home page Code Monkey logo

android-30's Introduction

Docker for Android SDK 30

Docker for Android SDK 30 with preinstalled build tools and emulator image

Edit from mindrunner/docker-android-sdk

Installed Packages

# sdkmanager --list
  Path                                        | Version | Description                                | Location
  -------                                     | ------- | -------                                    | -------
  build-tools;30.0.2                          | 30.0.2  | Android SDK Build-Tools 30.0.2             | build-tools/30.0.2/
  cmdline-tools;latest                        | 2.1     | Android SDK Command-line Tools (latest)    | cmdline-tools/latest/
  emulator                                    | 30.1.5  | Android Emulator                           | emulator/
  patcher;v4                                  | 1       | SDK Patch Applier v4                       | patcher/v4/
  platform-tools                              | 30.0.4  | Android SDK Platform-Tools                 | platform-tools/
  platforms;android-30                        | 3       | Android SDK Platform 30                    | platforms/android-30/
  system-images;android-30;google_apis;x86_64 | 8       | Google APIs Intel x86 Atom_64 System Image | system-images/android-30/google_apis/x86_64/

Usage

  • Interactive way

    $ docker run -it --rm --device /dev/kvm androidsdk/android-30:latest bash
    # check installed packages
    $ sdkmanager --list
    # create and run emulator
    $ avdmanager create avd -n first_avd --abi google_apis/x86_64 -k "system-images;android-30;google_apis;x86_64"
    $ emulator -avd first_avd -no-window -no-audio &
    $ adb devices
    # You can also run other Android platform tools, which are all added to the PATH environment variable

    To connect the emulator using adb on the docker host machine, start the container with --network host as well. You could also use scrcpy to do a screencast of the emulator.

  • Non-interactive way

    # check installed packages
    $ docker run -it --rm androidsdk/android-30:latest sdkmanager --list
    # list existing emulators
    $ docker run -it --rm androidsdk/android-30:latest avdmanager list avd
    # You can also run other Android platform tools, which are all added to the PATH environment variable

android-30's People

Contributors

inceabdullah avatar ppoffice avatar voldemat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

android-30's Issues

On Docker: Not able to launch emulator got error - CPU acceleration status: KVM requires a CPU that supports vmx or svm

On Docker: Not able to launch emulator got error - CPU acceleration status: KVM requires a CPU that supports vmx or svm

Available Updates:

ID Installed Available
cmdline-tools;latest 2.1 4.0
emulator 30.1.5 30.6.5
platform-tools 30.0.4 31.0.2
system-images;android-30;google_apis;x86_64 8 10

root@547e0a3576ac:/opt/android-sdk-linux# avdmanager create avd -n first_avd --abi google_apis/x86_64 -k "system-images;android-30;google_apis;x86_64"
Do you wish to create a custom hardware profile? [no] emote repository...
root@547e0a3576ac:/opt/android-sdk-linux# emulator -avd first_avd -no-window -no-audio &
[1] 113
root@547e0a3576ac:/opt/android-sdk-linux# emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
CPU acceleration status: KVM requires a CPU that supports vmx or svm
More info on configuring VM acceleration on Linux:
https://developer.android.com/studio/run/emulator-acceleration#vm-linux
General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration.

Windows 10

Even BIOS is enabled...still error is there.

Can you help me, how to run emulator on Docker?

Note: I went through few websites...which tells-
Emulator
ARM emulator is host machine independent, can run anywhere - Linux, macOS, VM and etc. While the performance is a bit poor. On the contrary, x86 emulator requires KVM, which means only runnable on Linux.

According to Google's documentation:

VM acceleration restrictions

Note the following restrictions of VM acceleration:

You can't run a VM-accelerated emulator inside another VM, such as a VM hosted by VirtualBox, VMWare, or Docker. You must run the emulator directly on your system hardware.

You can't run software that uses another virtualization technology at the same time that you run the accelerated emulator. For example, VirtualBox, VMWare, and Docker currently use a different virtualization technology, so you can't run them at the same time as the accelerated emulator.

android-31

Hi, Is there a plan to create a repo for android-31 as well? Thank you

Cannot create emulator in Bitbucket Pipeline

I am attempting to use a Bitbucket Pipeline to build and test android apps. The Bitbucket Pipeline contains three steps

  1. Lint Check
  2. Unit Tests
  3. Instrumentation Tests

While creating the emulator in the instrumentation tests I am getting the following error:

emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
CPU acceleration status: KVM requires a CPU that supports vmx or svm
More info on configuring VM acceleration on Linux:
https://developer.android.com/studio/run/emulator-acceleration#vm-linux
General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration.

The code for Bitbucket Pipeline is in bitbucket-pipelines.yml

# Bitbucket Pipelines Template to build, test your Android Application.

# This template contains 3 parallel steps to build Android application, run Android code scanning tool and run unit tests.
# For more details see https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/

# Docker for Android SDK 30 with pre-installed build tools and emulator image.
# Note: This docker image is created and maintained by a non official third party. For more details see: https://hub.docker.com/r/androidsdk/android-30
image: androidsdk/android-30
definitions:
  caches:
    gradle-wrapper: ~/.gradle/wrapper
    android-emulator: $ANDROID_HOME/system-images/android-30
pipelines:
  pull-requests:
    '**': #this runs as default for any branch not elsewhere defined
      - step:           # step to run lint (Android code scanning tool)
          name: Lint Check
          caches:       # caching speed up subsequent execution https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/
            - gradle
            - gradle-wrapper
          script:
            - ./gradlew ktlintCheck
          artifacts:
            - app/build/reports/**       # artifacts are files that are produced by a step https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/

      - parallel:
          - step:           # step to run unit tests
              name: Unit Tests
              script:
                - ./gradlew testDebugUnitTest # test reporting is automatically enabled https://support.atlassian.com/bitbucket-cloud/docs/test-reporting-in-pipelines/
              artifacts:
                - app/build/reports/**
          - step:
              name: Instrumentation Tests
              script:
                - ./instrumentation-tests.sh
              artifacts:
                - app/build/reports/**

The script for instrumentation test is in file instrumentation-tests.sh

#!/bin/bash

# Arm emulators can be quite slow. For this reason it is convenient
# to increase the adb timeout to avoid errors.
export ADB_INSTALL_TIMEOUT=30

# Create an ARM AVD emulator, with a 100 MB SD card storage space. Echo "no"
# because it will ask if you want to use a custom hardware profile, and you don't.
# https://medium.com/@AndreSand/android-emulator-on-docker-container-f20c49b129ef
echo "no" | avdmanager create avd \
    -n Android_R_API_30 \
    --abi google_apis/x86_64 \
    -k "system-images;android-30;google_apis;x86_64" \
    -c 100M \
    --force

# Launch the emulator in the background
$ANDROID_HOME/emulator/emulator -avd Android_R_API_30 -no-audio -no-window -no-boot-anim -gpu off -wipe-data &
EMULATOR_PID=$!

# Run the tests
./gradlew connectedDebugAndroidTest -i

# Stop the background processes
kill $EMULATOR_PID
# Note: You will have to add a suitable time delay, to wait for the emulator to launch.

Emulator is shown as out of date

While executing command - emulator -avd first_avd -no-window -no-audio &
Below error occcured.

root@d23fca28e0be:/opt/android-sdk-linux# emulator -avd first_avd -no-window -no-audio &
[1] 113
root@d23fca28e0be:/opt/android-sdk-linux# emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
WARNING. Using fallback path for the emulator registration directory.
Your emulator is out of date, please update by launching Android Studio:

  • Start Android Studio
  • Select menu "Tools > Android > SDK Manager"
  • Click "SDK Tools" tab
  • Check "Android Emulator" checkbox
  • Click "OK"

root@d23fca28e0be:/opt/android-sdk-linux# adb devices

  • daemon not running; starting now at tcp:5037
  • daemon started successfully
    List of devices attached
    emulator-5554 offline

Can you please help, how to resolve this error?
Your emulator is out of date, please update by launching Android Studio:
-> Do I need to open Android Studio (which I am using previously) which is installed on my laptop (Windows 10) out side Docker.

Issues with Sysdig scan

I team, i am using this image for my Gitlab CI. But my company sysdig scan has found the major and medium issues in below frameworks,
1.log4j, 2. protobuf, 3.guava - fix is 23.6.1 24.1.1 25.0, 4. commons-compress, 5.commns-codec.

Is it possible to fix this sysdig scan issues?

Preset LANG to en_US.UTF-8

The issue related to
https://confluence.atlassian.com/bitbucketserverkb/accented-or-extended-utf-8-characters-cause-malformed-input-or-input-contains-unmappable-characters-error-966062671.html

On Bitbucket pipeline some Gradle builds could crash with message:

Malformed input or input contains unmappable characters: #class path#

The image locale returns

LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

My issue is with Cucumber library. Exactly same as reported there:
cucumber/cucumber-android#41

Fixed by set export LANG="en_US.UTF-8" and run

apt-get clean && apt-get update -qq && apt-get install -qq -y apt-utils locales
locale-gen $LANG

before Gradle build run. But nice to see it as image default locale.

Is it possible to use the image directly on OSX or Windows (WSL 2)?

Was just curious if this only works directly on Linux, or if you happened to know of ways to get it working on containers running on top of Docker for Mac/WSL 2 as well (for local testing)

TL;DR

I just tried it on a Mac and ran into a warning when starting the emulator that "kvm" was missing and that hardware acceleration was required. AFAICT from a flurry of google searching OSX doesn't support kvm for virtualization, so I ended up concluding it might not be possible.

I'm in the process of trying it out on WSL 2 but I'm not optimistic about my chances there either given this outstanding issue around nested virtualization.

Is the only alternative to spin up Linux VMs and run Docker there instead? If not, would love to hear about what folks have done to make it work directly.

Thanks!

While installing apk get error - cmd: Can't find service: package

Hello,

Copied apk from local to Docker container.

C:\WINDOWS\system32>docker ps -l
CONTAINER ID   IMAGE                          COMMAND   CREATED          STATUS         PORTS     NAMES
2e5c65bc2f32   androidsdk/android-30:latest   "bash"    12 seconds ago   Up 6 seconds             intelligent_rubin

C:\WINDOWS\system32>docker cp C:\sample_apks\Calculator_base.apk  intelligent_rubin:/home

For installation of apk in docker used below command.

root@2e5c65bc2f32:/opt/android-sdk-linux# adb devices
List of devices attached
emulator-5554   device
root@2e5c65bc2f32:/opt/android-sdk-linux# adb install -r /home/Calculator_base.apk
Performing Streamed Install
adb: failed to install /home/Calculator_base.apk: cmd: Can't find service: package

Even I have checked that /home is having respective apk.

root@2e5c65bc2f32:/opt/android-sdk-linux# cd /home
root@2e5c65bc2f32:/home# ls
Calculator_base.apk

Can you please help me why above error occurred? cmd: Can't find service: package

Hello!

Is there documentation on how to use this image in detail?

e.g. I had to run apt-get install pulseaudio and libxcursor-dev to get the emulator to pop up a screen, but even then audio didn't work... I'm wondering if that is what this is for?

Should I be using the image to 'run a phone on my screen' or in some more technical way?

I can post a log of errors if that helps. e.g., one among several:

WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
WARNING | cannot add library /opt/android-sdk-linux/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed

Thank you for this image, it's a lot of fun to play with (crashes quite a bit though).

Cheers,
Dan.

None of the consumable configurations have attributes

Having build issues with the app and unsure why it's not working on BitBucket Pipelines. Works fine on the Windows 10 machine & internal Jenkins CI server. The repo has nested submodules.

Edit: After looking at it it looks like there's an issue with BitBucket so will report it to them.

FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:testUkAllinoneAdsWithIapReleaseUnitTest'.
> Could not resolve all task dependencies for configuration ':app:ukAllinoneAdsWithIapReleaseUnitTestRuntimeClasspath'.
   > Could not resolve project :lib:mediaServer.
     Required by:
         project :app
         project :app > project :hazard-perception
      > No matching configuration of project :lib:mediaServer was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:poppy.
     Required by:
         project :app
      > No matching configuration of project :lib:poppy was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:mathete-voiceover-player.
     Required by:
         project :app
      > No matching configuration of project :lib:mathete-voiceover-player was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:parsnip.
     Required by:
         project :app
         project :app > project :hazard-perception
      > No matching configuration of project :lib:parsnip was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:mathete-book-position-persister.
     Required by:
         project :app
      > No matching configuration of project :lib:mathete-book-position-persister was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:learn2registration.
     Required by:
         project :app
         project :app > project :hazard-perception
      > No matching configuration of project :lib:learn2registration was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:imagitech-onboarding:lib.
     Required by:
         project :app
      > No matching configuration of project :lib:imagitech-onboarding:lib was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:imagitech-licensing:licensing-core.
     Required by:
         project :app
         project :app > project :hazard-perception
      > No matching configuration of project :lib:imagitech-licensing:licensing-core was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:imagitech-licensing:licensing-dialog.
     Required by:
         project :app
         project :app > project :hazard-perception
      > No matching configuration of project :lib:imagitech-licensing:licensing-dialog was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:imagitech-searchable-documents:searchable-documents-core.
     Required by:
         project :app
         project :app > project :hazard-perception
      > No matching configuration of project :lib:imagitech-searchable-documents:searchable-documents-core was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:android-sqlite-asset-helper:library.
     Required by:
         project :app
      > No matching configuration of project :lib:android-sqlite-asset-helper:library was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:imagitech-searchable-documents:highway-code.
     Required by:
         project :app
         project :app > project :hazard-perception
      > No matching configuration of project :lib:imagitech-searchable-documents:highway-code was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:imagitech-telemetry:core.
     Required by:
         project :app > project :core
         project :app > project :hazard-perception
      > No matching configuration of project :lib:imagitech-telemetry:core was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:imagitech-telemetry:api-firebase.
     Required by:
         project :app > project :core
         project :app > project :hazard-perception
      > No matching configuration of project :lib:imagitech-telemetry:api-firebase was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:imagitech-library.
     Required by:
         project :app > project :core
         project :app > project :lib:mathete
         project :app > project :hazard-perception
      > No matching configuration of project :lib:imagitech-library was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:mathete-question.
     Required by:
         project :app > project :lib:mathete
      > No matching configuration of project :lib:mathete-question was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
   > Could not resolve project :lib:imagitech-onboarding:viewPagerIndicator.
     Required by:
         project :app > project :hazard-perception
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
      > No matching configuration of project :lib:imagitech-onboarding:viewPagerIndicator was found. The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'monetisation' with value 'adsWithIap', attribute 'testType' with value 'ukAllinone', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 52s

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.