Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/Add Android NDK r23 LTS #3894

Closed
5 of 9 tasks
Javernaut opened this issue Aug 14, 2021 · 18 comments
Closed
5 of 9 tasks

Update/Add Android NDK r23 LTS #3894

Javernaut opened this issue Aug 14, 2021 · 18 comments

Comments

@Javernaut
Copy link

Tool name

Android NDK

Tool license

Same as before

Add or update?

  • Add
  • Update

Desired version

23.0.7599858

Approximate size

2.16 Gb (for macos)

Brief description of tool

No response

URL for tool's homepage

https://developer.android.com/ndk/downloads

Provide a basic test case to validate the tool's functionality.

No response

Virtual environments affected

  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11
  • Windows Server 2016
  • Windows Server 2019

Can this tool be installed during the build?

No response

Tool installation time in runtime

No response

Are you willing to submit a PR?

No response

@al-cheb
Copy link
Contributor

al-cheb commented Aug 16, 2021

Hello, @Javernaut
We will take a look at the issue.

@kenmorse
Copy link

kenmorse commented Sep 7, 2021

The current images include:

  • 22.1.7171670 — NDK r22b (March 2021)
  • 21.4.7075529 — NDK r21e LTS (January 2021)

The guidelines indicated that the installation strategy for the Android NDK is, "1 latest, 1 LTS version". With the NDK r23 LTS, the latest and the LTS version are the same. So in this case, does it make sense to replace r22b with r23 and keep r21e:

  • 23.0.7599858 — NDK r23 LTS (August 2021)
  • 21.4.7075529 — NDK r21e LTS (January 2021)

Or instead replace the LTS version and keep the previous version:

  • 23.0.7599858 — NDK r23 LTS (August 2021)
  • 22.1.7171670 — NDK r22b (March 2021)

?

@maxim-lobanov
Copy link
Contributor

Hello @kenmorse , we would like to install 21, 22, 23 side by side for now and PRs will be provided soon
Previously, we couldn't afford it but currently we can.
@MaksimZhukov will update policy soon.

@MaksimZhukov MaksimZhukov added the awaiting-deployment Code complete; awaiting deployment and/or deployment in progress label Sep 23, 2021
@miketimofeev
Copy link
Contributor

macOS images with NDK 23 were deployed, ubuntu is deploying this week

@palumbo67
Copy link

macOS images with NDK 23 were deployed, ubuntu is deploying this week

I ran my pipeline this morning and it still failed searching for NDK. How long does this usually take?

@MaksimZhukov
Copy link
Contributor

Hello @palumbo67!
Usually, it takes 3-4 days to propagate the images to all environments if there are no issues

@kenmorse
Copy link

kenmorse commented Sep 28, 2021

@palumbo67 — while you are waiting, something like this might help (on Ubuntu):

  - name: Check for specific NDK
    run: |
        [ ! -d "$ANDROID_NDK_ROOT/23.0.7599858" ] && echo "NDK_23_0_7599858=not available" >> $GITHUB_ENV

  - name: NDK Cache
    if: ${{ env.NDK_23_0_7599858 == 'not available' }}
    id: ndk-cache
    uses: actions/cache@v2
    with:
      path: /usr/local/lib/android/sdk/ndk/23.0.7599858
      key: ndk-cache-23.0.7599858

  - name: Install NDK
    if: ${{ env.NDK_23_0_7599858 == 'not available' && steps.ndk-cache.outputs.cache-hit != 'true' }}
    run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;23.0.7599858"

If the NDK is already on the environment, the next two steps are skipped. If it's not there, the cache is used, and if the cache isn't there either, the specific NDK is installed.

@JELaVallee
Copy link

After the ubuntu-latest (ubuntu20/20210929.1) rolled out, our flutter build appbundle workflow step has started failing with the following error:

Running Gradle task 'bundleRelease'...                          
Removed unused resources: Binary resource data reduced from 530KB to 518KB: Removed 2%

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:stripReleaseDebugSymbols'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi

Was building w/o error up until yesterday when running on ubuntu20/20210919.1

Nothing changed in our gradle configs since yesterday and not seeing this in our macOS or ubuntu20 local development environments.

Anyone else seeing this with flutter/android builds?

@mqueiroz1995
Copy link

After the ubuntu-latest (ubuntu20/20210929.1) rolled out, our flutter build appbundle workflow step has started failing with the following error:

Running Gradle task 'bundleRelease'...                          
Removed unused resources: Binary resource data reduced from 530KB to 518KB: Removed 2%

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:stripReleaseDebugSymbols'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi

Was building w/o error up until yesterday when running on ubuntu20/20210919.1

Nothing changed in our gradle configs since yesterday and not seeing this in our macOS or ubuntu20 local development environments.

Anyone else seeing this with flutter/android builds?

We are experiencing the same issue. No changes in our build config, but they started to fail with a similar problem:

2021-09-30T21:05:53.5662409Z > Task :REDACTED:stripReleaseDebugSymbols FAILED
2021-09-30T21:05:53.5664537Z Task :REDACTED:stripReleaseDebugSymbols in advertising Starting
2021-09-30T21:05:53.5666278Z android.ndkVersion from module build.gradle is not set
2021-09-30T21:05:53.5668250Z ndk.dir in local.properties is not set
2021-09-30T21:05:53.5670571Z ANDROID_NDK_HOME environment variable is /usr/local/lib/android/sdk/ndk-bundle
2021-09-30T21:05:53.5675033Z sdkFolder is /usr/local/lib/android/sdk
2021-09-30T21:05:53.5676417Z WARNING: Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
2021-09-30T21:05:53.5679509Z Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
2021-09-30T21:05:53.5681418Z Considering /usr/local/lib/android/sdk/ndk-bundle by ANDROID_NDK_HOME
2021-09-30T21:05:53.5683008Z Considering /usr/local/lib/android/sdk/ndk-bundle in SDK ndk-bundle folder
2021-09-30T21:05:53.5684152Z Considering /usr/local/lib/android/sdk/ndk/21.4.7075529 in SDK ndk folder
2021-09-30T21:05:53.5685209Z Considering /usr/local/lib/android/sdk/ndk/23.0.7599858 in SDK ndk folder
2021-09-30T21:05:53.5686431Z Considering /usr/local/lib/android/sdk/ndk/22.1.7171670 in SDK ndk folder
2021-09-30T21:05:53.5688319Z No user requested version, choosing /usr/local/lib/android/sdk/ndk/23.0.7599858 which is version 23.0.7599858
2021-09-30T21:05:53.5691035Z Build cache key for task ':REDACTED:stripReleaseDebugSymbols' is e9530c977572597b70cdf3325dc22956
2021-09-30T21:05:53.5693595Z Task ':REDACTED:stripReleaseDebugSymbols' is not up-to-date because:
2021-09-30T21:05:53.5694968Z   No history is available.
2021-09-30T21:05:53.5696760Z The input changes require a full rebuild for incremental task ':android:NextgenAndroidApp:stripReleaseDebugSymbols'.
2021-09-30T21:05:53.5698529Z Unable do incremental execution: full task run
2021-09-30T21:05:53.5704378Z Starting process 'command '/usr/local/lib/android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip''. Working directory: /home/runner/work/REDACTED Command: /usr/local/lib/android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded -o /home/runner/work/REDACTED/build/intermediates/stripped_native_libs/release/out/lib/armeabi-v7a/libjsijniprofiler.so /home/runner/work/REDACTED/build/intermediates/merged_native_libs/release/out/lib/armeabi-v7a/libjsijniprofiler.so
2021-09-30T21:05:53.5709064Z Task :REDACTED:stripReleaseDebugSymbols in advertising Finished
2021-09-30T21:05:53.5711114Z :REDACTED:stripReleaseDebugSymbols (Thread[Execution worker for ':',5,main]) completed. Took 0.369 secs.
2021-09-30T21:05:53.7665157Z 
2021-09-30T21:05:53.7665998Z 
2021-09-30T21:05:53.7667611Z FAILURE: Build failed with an exception.
2021-09-30T21:05:53.7668804Z Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
2021-09-30T21:05:53.7670472Z 
2021-09-30T21:05:53.7672260Z Use '--warning-mode all' to show the individual deprecation warnings.
2021-09-30T21:05:53.7674536Z * What went wrong:
2021-09-30T21:05:53.7676385Z See https://docs.gradle.org/6.2.2/userguide/command_line_interface.html#sec:command_line_warnings
2021-09-30T21:05:53.7679227Z Execution failed for task ':android:NextgenAndroidApp:stripReleaseDebugSymbols'.
2021-09-30T21:05:53.7680989Z 699 actionable tasks: 347 executed, 352 from cache
2021-09-30T21:05:53.7683006Z > 1 exception was raised by workers:
2021-09-30T21:05:53.7685967Z   org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/usr/local/lib/android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip''

...

2021-09-30T21:05:53.8654995Z Caused by: java.io.IOException: Cannot run program "/usr/local/lib/android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip" (in directory "/home/runner/work/olx-mobile/olx-mobile/olx/android/android/NextgenAndroidApp"): error=2, No such file or directory

@dibir-magomedsaygitov
Copy link
Contributor

dibir-magomedsaygitov commented Oct 1, 2021

Hello @mqueiroz1995. Could you please share content of gradle-wrapper.properties and build.gradle files?

@DaVaMa1
Copy link

DaVaMa1 commented Oct 4, 2021

We're experiencing the exact same issue with our Flutter builds and it's been halting our entire workflow for the past week, both on ubuntu as well as MacOs agents:

* What went wrong:
Execution failed for task ':app:stripDswDebugDebugSymbols'.
> 1 exception was raised by workers:
  org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/Users/runner/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip''

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

build.gradle:

buildscript {
    ext.kotlin_version = '1.5.30'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:perf-plugin:1.4.0'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()

        maven { url 'https://jitpack.io' }
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Don't know if it matters, but due to some issues we're still on Flutter 1.22.6.

@MaksimZhukov
Copy link
Contributor

All the images with Android NDK r23 have been deployed.

@DaVaMa1
Copy link

DaVaMa1 commented Oct 4, 2021

Update, changing from gradle 3.6.4 to 4.2.0 seems to have fixed the issue for the pipeline for us.

@MaksimZhukov MaksimZhukov removed the awaiting-deployment Code complete; awaiting deployment and/or deployment in progress label Oct 4, 2021
@miketimofeev
Copy link
Contributor

@DaVaMa1 there is no ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip file as the error mentioned. Please file an issue in the https://github.com/android/ndk/issues
As a workaround you can uninstall ndk 23, which allows you to use ndk22 instead:

macOS:

SDKMANAGER=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager
ndkFullVersion=$($SDKMANAGER --list | grep "ndk;23.*" | awk '{gsub("ndk;", ""); print $1}' | sort -V | tail -n1)
echo y | $SDKMANAGER --uninstall "ndk;${ndkFullVersion}"

ubuntu:

SDKMANAGER=/usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager
ndkFullVersion=$($SDKMANAGER --list | grep "ndk;23.*" | awk '{gsub("ndk;", ""); print $1}' | sort -V | tail -n1)
echo y | $SDKMANAGER --uninstall "ndk;${ndkFullVersion}"

@DaVaMa1
Copy link

DaVaMa1 commented Oct 4, 2021

O wow, thats a huge help, my bash is on hello world level so I would not have figured that out quickly by myself.
Workaround seems to work, our AppCenter build is green again, thanks!

This issue on the NDK tells that the behaviour is expected, so it seems to be working as intended.
I'm guessing that for Flutter builds the flutter sdk should have this fixed in some version, and as we're pretty far behind we don't get that fix.

@DaVaMa1
Copy link

DaVaMa1 commented Oct 20, 2021

Small update for the work around, as we're still in need of it, I'm guessing a new ndk version 23 has been released and it now tries to uninstall an available version opposed to an installed version. I fixed it by using this

SDKMANAGER=/usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager
ndkFullVersions=$($SDKMANAGER --list_installed | grep "ndk;23.*" | awk '{gsub("ndk;", ""); print $1}')
for version in $ndkFullVersions
do $SDKMANAGER --uninstall "ndk;$version"
done

instead of the old work around. Took me a while to debug on the agents, especially since this was my first time using bash.
Works on linux, not sure about mac but I'm guessing take the same approach. As long as only 1 version 23 is installed at the same time just changing --list to --list_installed should work

@palumbo67
Copy link

SDKMANAGER=/usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager
ndkFullVersions=$($SDKMANAGER --list_installed | grep "ndk;23.*" | awk '{gsub("ndk;", ""); print $1}')
for version in $ndkFullVersions
do $SDKMANAGER --uninstall "ndk;$version"
done

Has anyone managed to get to translate this to windows?

@miketimofeev
Copy link
Contributor

@palumbo67 here you are, this powershell snippet will uninstall the latest ndk 23.

$sdkRoot = "C:\Android\android-sdk"
$sdkManager = "$sdkRoot\cmdline-tools\latest\bin\sdkmanager.bat"
$androidPackages = Get-AndroidPackages -AndroidSDKManagerPath $sdkManager
$ndkLatestVersion = Get-AndroidPackagesByName -AndroidPackages $androidPackages -PrefixPackageName "ndk;23" | Sort-Object -Unique | Select-Object -Last 1
& $sdkManager --uninstall "$ndkLatestVersion"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests