I'm trying to set up a Github Codespace for Android Development.
Codespace machine configuration:
- VS Code through Browser (Chrome)
- 4 Core CPU, 8 GB RAM
- Free tier Codespace (i.e. 15GB-month, etc.)
So to setup the codespace for Android dev., I used VSCode's way of creating a devcontainer and had the following configuration in ./.devcontainer/devcontainer.json
:
{
"name": "Android Container",
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers-contrib/features/gradle-sdkman:2": {
"version": "latest",
"jdkVersion": "11",
"jdkDistro": "ms"
},
"ghcr.io/devcontainers-contrib/features/kotlin-sdkman:2": {
"version": "latest",
"jdkVersion": "11",
"jdkDistro": "ms"
},
"ghcr.io/mikaello/devcontainer-features/kotlinc:1": {},
"ghcr.io/akhildevelops/devcontainer-features/android-cli:0": {},
"ghcr.io/jarrodcolburn/features/android-sdk:0": {
"platforms": "27",
"build-tools": "33.0.2"
}
}
}
Just gave a random name. This also uses JDK 11 as java downloaded by Android Studio gives this:
java --version
openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)
OpenJDK 64-Bit Server VM (build 11.0.15+0-b2043.56-9505619, mixed mode)
On my Win11 PC.
But when I "Rebuild Container", Codespace shows "Container build failed" on the "Setting up your codespace" page.
Then it opens in a recovery env. And this is the creation log
Just to make it easier, this is the place of the error:
2023-04-30 03:17:03.814Z: #20 55.72
#20 55.72 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#20 55.72
#20 55.84
#20 55.84 Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, see:
#20 55.84 https://github.com/rvm/rvm/issues/3212
#20 55.84
2023-04-30 03:17:05.920Z: #20 57.89 ./install.sh: 32: Syntax error: "(" unexpected
#20 57.89 ERROR: Feature "Android SDK" (ghcr.io/jarrodcolburn/features/android-sdk) failed to install!
2023-04-30 03:17:06.624Z: #20 ERROR: executor failed running [/bin/sh -c cp -ar /tmp/build-features-src/android-sdk_5 /tmp/dev-container-features && chmod -R 0755 /tmp/dev-container-features/android-sdk_5 && cd /tmp/dev-container-features/android-sdk_5 && chmod +x ./devcontainer-features-install.sh && ./devcontainer-features-install.sh && rm -rf /tmp/dev-container-features/android-sdk_5]: exit code: 2
2023-04-30 03:17:06.630Z: ------
> [dev_containers_target_stage 8/9] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=android-sdk_5,target=/tmp/build-features-src/android-sdk_5 cp -ar /tmp/build-features-src/android-sdk_5 /tmp/dev-container-features && chmod -R 0755 /tmp/dev-container-features/android-sdk_5 && cd /tmp/dev-container-features/android-sdk_5 && chmod +x ./devcontainer-features-install.sh && ./devcontainer-features-install.sh && rm -rf /tmp/dev-container-features/android-sdk_5:
#20 55.60 done.
#20 55.72
#20 55.72 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#20 55.72
#20 55.84
#20 55.84 Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, see:
#20 55.84 https://github.com/rvm/rvm/issues/3212
#20 55.84
#20 57.89 ./install.sh: 32: Syntax error: "(" unexpected
#20 57.89 ERROR: Feature "Android SDK" (ghcr.io/jarrodcolburn/features/android-sdk) failed to install!
------
2023-04-30 03:17:06.633Z: ERROR: failed to solve: executor failed running [/bin/sh -c cp -ar /tmp/build-features-src/android-sdk_5 /tmp/dev-container-features && chmod -R 0755 /tmp/dev-container-features/android-sdk_5 && cd /tmp/dev-container-features/android-sdk_5 && chmod +x ./devcontainer-features-install.sh && ./devcontainer-features-install.sh && rm -rf /tmp/dev-container-features/android-sdk_5]: exit code: 2
2023-04-30 03:17:06.659Z: Stop: Run: docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-root/container-features/0.37.0-1682824276795 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/universal:2 --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-egnore-7f7c330024417fc1c88d19e7d01b832cf3eafa6230f5d96d870e989a2113e130-features -f /tmp/devcontainercli-root/container-features/0.37.0-1682824276795/Dockerfile.extended /var/lib/docker/codespacemount/.persistedshare/empty-folder
2023-04-30 03:17:06.664Z: {"outcome":"error","message":"Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-root/container-features/0.37.0-1682824276795 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/universal:2 --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-egnore-7f7c330024417fc1c88d19e7d01b832cf3eafa6230f5d96d870e989a2113e130-features -f /tmp/devcontainercli-root/container-features/0.37.0-1682824276795/Dockerfile.extended /var/lib/docker/codespacemount/.persistedshare/empty-folder","description":"An error occurred setting up the container."}
2023-04-30 03:17:06.671Z: Error: Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-root/container-features/0.37.0-1682824276795 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/universal:2 --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-egnore-7f7c330024417fc1c88d19e7d01b832cf3eafa6230f5d96d870e989a2113e130-features -f /tmp/devcontainercli-root/container-features/0.37.0-1682824276795/Dockerfile.extended /var/lib/docker/codespacemount/.persistedshare/empty-folder
2023-04-30 03:17:06.675Z: at wse (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:1916:3264)
2023-04-30 03:17:06.677Z: at K7 (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:1916:3200)
2023-04-30 03:17:06.679Z: at processTicksAndRejections (internal/process/task_queues.js:95:5)
2023-04-30 03:17:06.680Z: at async Hse (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:1931:2626)
2023-04-30 03:17:06.695Z: at async Ch (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:1931:3741)
2023-04-30 03:17:06.706Z: at async cae (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2059:17376)
2023-04-30 03:17:06.715Z: at async uae (/usr/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:2059:17117)
2023-04-30 03:17:06.717Z: devcontainer process exited with exit code 1
====================================== ERROR ====================================
2023-04-30 03:17:06.724Z: Failed to create container.
=================================================================================
2023-04-30 03:17:06.726Z: Error: Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-root/container-features/0.37.0-1682824276795 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/universal:2 --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-egnore-7f7c330024417fc1c88d19e7d01b832cf3eafa6230f5d96d870e989a2113e130-features -f /tmp/devcontainercli-root/container-features/0.37.0-1682824276795/Dockerfile.extended /var/lib/docker/codespacemount/.persistedshare/empty-folder
2023-04-30 03:17:06.729Z: Error Code: 1302
====================================== ERROR ====================================
2023-04-30 03:17:06.731Z: Container creation failed.
=================================================================================
2023-04-30 03:17:06.741Z:
===================================== WARNING ===================================
2023-04-30 03:17:06.758Z: Creating recovery container.
=================================================================================
Did search this up but found only this issue:
https://github.com/microsoft/vscode/issues/180495
and it doesn't help
So is there anyway to solve this problem?