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

Issue with NDK and com.android.tools.build:gradle:3.6.0(3.6.1) #1728

Closed
ArtyomBasharkevich opened this issue Mar 5, 2020 · 22 comments
Closed
Assignees
Labels
build Related to App Center's Build service feature request New feature request

Comments

@ArtyomBasharkevich
Copy link

Your support team told me to write here.
I use ndk in the project and after updating android studio and com.android.tools.build:gradle to 3.6.0 I can’t build the project in appcenter, but I can on the local computer.

What went wrong:
Execution failed for task ':app:generateJsonModelDev'.

Expected NDK STL shared object file at /Users/runner/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_shared.so
BUILD FAILED in 1m 20s
24 actionable tasks: 23 executed, 1 up-to-date
Error: /Users/runner/runners/2.165.0/work/1/s/gradlew failed with return code: 1
at ChildProcess. (/Users/runner/runners/2.165.0/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/1.128.0/node_modules/vsts-task-lib/toolrunner.js:569:30)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Socket. (internal/child_process.js:351:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:509:12)
##[error]Error: /Users/runner/runners/2.165.0/work/1/s/gradlew failed with return code: 1

When I specify the ndk version explicitly I get this:
A problem occurred configuring project ':app'.

No version of NDK matched the requested version 21.0.6113669. Versions available locally: 18.1.5063045, 18.1.5063045

When I downgrade the ndkVesrion I receive such message in android studio:
Requested NDK version 18.1.5063045 did not match the version 21.0.6113669 requested by ndk.dir at ...

Downgrading com.android.tools.build:gradle version solves the problem, but I want to use the latest one.

@ArtyomBasharkevich ArtyomBasharkevich added the feature request New feature request label Mar 5, 2020
@kamalh16
Copy link

kamalh16 commented Mar 6, 2020

Also experiencing the same issue after updating android (3.6.1) and gradle (3.6.1).

  • What went wrong:
    Execution failed for task ':app:generateJsonModelCdxDebug'.
    Expected NDK STL shared object file at /Users/runner/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_shared.so

  • 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 1m 9s
11 actionable tasks: 11 executed
Error: /Users/runner/runners/2.165.0/work/1/s/application/gradlew failed with return code: 1
at ChildProcess. (/Users/runner/runners/2.165.0/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/1.128.0/node_modules/vsts-task-lib/toolrunner.js:569:30)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Socket. (internal/child_process.js:351:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:509:12)
##[error]Error: /Users/runner/runners/2.165.0/work/1/s/application/gradlew failed with return code: 1

Thanks for your help.

@MoeHamoud
Copy link

raises hand

ditto, same issue here!

@azakharenka1
Copy link

Same!

@winnie
Copy link

winnie commented Mar 11, 2020

Adding @elamalani to provide an update on timeline. Looks similar to #1740 .

@dacheng81
Copy link

Same issue here.
After updating to Gradle tools 3.6.1, apparently Azure Devops (where we do CI) fails because it only has version 21.0.6113669. So in order to support Azure Devops, we set ndkVersion to 21.0.6113669 in our build.gradle. (Without specifying ndkVersion, app is looking for version 20.x)

However, because of that, AppCenter fails to build because AppCenter only has 18.1.5063045 or 18.1.5063045. 🤷‍♂

@D3laru3
Copy link

D3laru3 commented Mar 20, 2020

@elamalani any updates on this? timeline? we have to react base on your status
Thanks

@King-of-Spades King-of-Spades added the build Related to App Center's Build service label Mar 20, 2020
@elamalani
Copy link

@D3laru3 This is a new feature request in App Center. We don't plan to support it at the moment but we'll keep this issue open for visibility and would let you know once we decide to support it in the product.

@MaxenceMax
Copy link

18.1.5063045 version is now deprecated, 20 version minium is recommended, please upgrade your NDK version. @elamalani

@elamalani
Copy link

@MaxenceMax Let me talk to the team and see how we could prioritize this issue.

@bogdantmm92
Copy link

Any news on this @elamalani ?

@elamalani
Copy link

@bogdantmm92 We are working on it currently and will have an update soon. I will keep this thread posted once the changes are live.

@elamalani
Copy link

I've an update on this issue - we have updated Android NDK version in App Center Build. Can you please give it a try and let me know if it works for you?

@dacheng81
Copy link

I have specified ndkVersion '21.0.6113669' in our build.gradle and AppCenter is able to build now. Thanks @elamalani !

@elamalani
Copy link

Closing it as the issue has been resolved.

@MoeHamoud
Copy link

MoeHamoud commented Jun 2, 2020

Hey @elamalani , in the build env is there any way to provide backwards compatibility for 1 version back as well as the most recent version of the NDK?

For instance, just yesterday the version for the NDK was 21.1.6352462 and today it's bumped up to 21.2.6472646 so our builds are failing again. Is there a chance the team could keep up to 2 versions back? For instance, here's the error message I'm receiving from the console output: No version of NDK matched the requested version 21.1.6352462. Versions available locally: 18.1.5063045, 21.2.6472646, 21.2.6472646, notice that the last 2 versions "available locally" are the exact same.

My suggestion is to support 18.1.5063045, support 1 version behind which is 21.1.6352462, and then support the latest 21.2.6472646.

Is this a feasible request? I'm sure others will also run into this problem today.

@dacheng81
Copy link

I faced this exact same issue when AppCenter went from 21.0.6113669 to 21.1.6352462. Was communicating with James from AppCenter support.

Because now we have to specify which NDK to use in the gradle, if a slightly-older version is abruptly removed locally on the VM, all our builds fail until we update.

@MoeHamoud
Copy link

MoeHamoud commented Jun 16, 2020

Hi @elamalani, it happened again. AppCenter's ndk version has been bumped to 21.3.6528147 and our builds are failing as previously mentioned. I'm sure others will run into this problem again. We love your distribution system on AppCenter but these abrupt changes to the build environment is quite disheartening.

Can we please get some input from you or a team member?

@AlenaSviridenko
Copy link

Hi @MoeHamoud,
Keeping two versions back is possible but they will still be updated when the new latest one is released, so I believe this won't solve the initial issue with versions being unexpectedly updated.

If you need to use the exact hardcoded version of NDK I would suggest to use a pre-build script (guide reference) that will be executed automatically after installing dependencies. In this script you can install any version you need with the following code:

#!/usr/bin/env bash

SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
echo y | $SDKMANAGER "ndk;<major.minor.build>"

Also, you can track our image updates on a weekly cadence on this page to be aware of new software https://docs.microsoft.com/en-us/appcenter/build/software

Please, let me know if you have any questions.

@MoeHamoud
Copy link

Morning @AlenaSviridenko,

Thanks for getting back to us and providing that script. I do realize that at the end of the day we would still need to update our ndk versions, however, what some of us are proposing in this thread is to allow up to 2 versions back of the latest last 2 ndk releases in the build environment. This way when a new ndk version is released and it's applied to the build environment, our builds will still work until the next version release of the ndk - this way we have a bit of a grace period to apply the changes on our end.

As an error msg we see (pulled from above as an ex.): "No version of NDK matched the requested version 21.1.6352462. Versions available locally: 18.1.5063045, 21.2.6472646, 21.2.6472646"

So for example the available ones in the env are: [18.1.5063045, 21.2.6472646, 21.2.6472646]

Notice the last two are the exact same? So say you update ndkVersion[2] from above, is it not possible to keep ndkVersion[0] and ndkVersion[1] until the next ndk version is released? This way, on a new ndk version release; ndkVersion[2] from above would become ndkVersion[1] and the latest would take its place at ndkVersion[2].

Thanks again!

@AlenaSviridenko
Copy link

Hi @MoeHamoud,

I got you idea, but keeping 3 versions of NDK (r18 is always presented for compatibility with old Xamarin.Android apps) requires a significant amount of space and a complex support, and still new release could break someone who didn't notice the update, so we currently don't have plans to make this change. Probably we will revisit this strategy later.

Usage of pre-build script will help you to detect when NDK version is bumped up without breaking the build: if your hard-coded version in build.gradle matches the version on image - script won't install anything, but if version is bumped up - script will download your version and you will notice the increased build time (~1.5 min) because of it, your build won't fail, and still you will know that the version on image was updated.

Thank you.

@MoeHamoud
Copy link

@AlenaSviridenko Ok great, thanks for getting involved in the discussion and for the clear explanation!

@antoinerousseau
Copy link

Adding an appcenter-pre-build.sh file with the content given by @AlenaSviridenko (thanks!) was for me the beginning of the solution since I also needed an older NDK... BUT it failed with the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

This is because I need Java 11 for React Native, so I have JAVA_HOME=$(JAVA_HOME_11_X64) setup in my app env build settings

So I just specified the Java version to use for the SDK manager:

#!/usr/bin/env bash

SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
echo y | JAVA_HOME=$JAVA_HOME_8_X64 $SDKMANAGER "ndk;21.4.7075529"

(replace 21.4.7075529 with whatever NDK version you need or course, probably the same as your ndkVersion in your build.gradle)

The available Java versions in the AppCenter build image are given at the beginning of the logs output: look for "Included Software", e.g. https://github.com/actions/runner-images/blob/macOS-11/20231117.2/images/macos/macos-11-Readme.md#java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to App Center's Build service feature request New feature request
Projects
None yet
Development

No branches or pull requests