Deprecated Docker Image

I replaced the deprecated docker image android:api-28-ndk in config.yml:

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-28-ndk

with

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
      - image: cimg/android:2023.02-ndk

but get build errors due using a newer/different Android version. How can I use a non-deprecated image without rewriting my code?

  The first 3 errors (out of 34) were:
  /home/circleci/code/app/src/main/java/io/x/app/gateway/features/pubsub/subscribe/commander/commands/wifi/AddWifi.java:84: Error: Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException [MissingPermission]
              List<ScanResult> scanResultList = wifiManager.getScanResults();
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/circleci/code/app/src/main/java/io/x/app/gateway/features/pubsub/subscribe/commander/commands/wifi/AddWifi.java:109: Error: Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException [MissingPermission]
          List<WifiConfiguration> wifiConfigList = wifiManager.getConfiguredNetworks();
                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/circleci/code/app/src/main/java/io/x/app/gateway/features/pubsub/subscribe/commander/commands/wifi/AddWifiConfig.java:98: Error: Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException [MissingPermission]
              List<ScanResult> scanResultList = wifiManager.getScanResults();
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi @ronlevine1 it seems that the build errors you are receiving are caused because you do not request runtime permissions. As for using a new image, you can try using an older system-image such as system-images;android-28;default;x86 which should be what the old image was using. If that doesn’t work you can pin the image you have been using and continue to use it.

I tried getting the system-images;android-28;default;x86 image but the operation failed. I assume the syntax is not correct

I looked at the using the android:api-28-ndk base image in the Spin up Environment step and

  build:
    working_directory: ~/code
    docker:
      - image: system-images;android-28;default;x86

Hi @ronlevine1 what step of your workflow is this error occuring? The system-image I suggested isn’t an image that we provide, rather an emulator image provisioned by google because I assumed that error is happening when you run your emulator.

The error is in the Download Dependencies step using the image: circleci/android:api-28-ndk

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 8s
1 actionable task: 1 executed
Get:1 http://deb.debian.org/debian buster InRelease [122 kB]
Get:2 http://security.debian.org/debian-security buster/updates InRelease [34.8 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [56.6 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [469 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7909 kB]
Get:6 https://packages.cloud.google.com/apt cloud-sdk-buster InRelease [6396 B]
Get:7 http://deb.debian.org/debian buster-updates/main amd64 Packages [8788 B]
Err:6 https://packages.cloud.google.com/apt cloud-sdk-buster InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
Reading package lists... Done
W: GPG error: https://packages.cloud.google.com/apt cloud-sdk-buster InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
E: The repository 'https://packages.cloud.google.com/apt cloud-sdk-buster InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Hi @ronlevine1 can you link me a pipeline with that step failing on the cimg/android:2023.02-ndk image?

https://app.circleci.com/pipelines/bitbucket/elementalmachines/gateway/1783/workflows/b6c95962-a289-4804-9511-9cdc5b0f4f73/jobs/2340

Hi @ronlevine1 if you don’t want to rewrite the errors that were thrown you can add
android { lintOptions { abortOnError false } } to your build script, but this does not seem to be an issue with the image rather your gradlew lint catching issues within your code.

I made the change in build.gradle

lintOptions {
    abortOnError false
}

but the pipeline still fails

https://app.circleci.com/pipelines/bitbucket/elementalmachines/gateway/1785/workflows/591fd8ad-bc26-43be-aeee-02a2145e3582/jobs/2342

Hi, can you open a support ticket so that the support team can help you with this issue?