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

Realm NDK version #4740

Closed
lucioreyli opened this issue Jul 27, 2022 · 15 comments
Closed

Realm NDK version #4740

lucioreyli opened this issue Jul 27, 2022 · 15 comments

Comments

@lucioreyli
Copy link

lucioreyli commented Jul 27, 2022

How frequently does the bug occur?

All the time

Description

I'm trying to build an Android app (APK) on the App Center but the Realm NDK version require 21.0.6113669 and the App Center has only this versions available: 21.4.7075529, 23.2.8568313, 24.0.8215888.

Both following files have the same version:

// android/build.gradle
ndkVersion = "21.4.7075529"
// android/app/build.gradle
ndkVersion "21.4.7075529"

Stacktrace & log output

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':realm:stripDebugDebugSymbols'.
> No version of NDK matched the requested version 21.0.6113669. Versions available locally: 21.4.7075529, 23.2.8568313, 24.0.8215888

* 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 5m 56s

Can you reproduce the bug?

Not yet

Reproduction Steps

No response

Version

10.19.5

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

Android - the version doesn't matter

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

@tomduncalf
Copy link
Contributor

@lucioroadtoglory Thanks for the report, this sounds like an issue with AppCenter. According to this response, you should be able to add a pre-build step which to install 21.0.6113669 before continuing with your build. We'd rather not modify the version specified in Realm just to match a specific platform's setup, as this could impact other users unnecessarily.

Please let me know if this doesn't solve your problem!

@lucioreyli
Copy link
Author

It's works very well! I added at my appcenter-pre-build.sh(pre-build script) the following code:

SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
echo y | $SDKMANAGER "ndk;21.0.6113669"

The version 21.0.6113669 is the version that Realm needs. Thanks!

@tomduncalf
Copy link
Contributor

I'm happy that it worked! :)

@NoelMiranda1
Copy link

Hello, I have this same problem with the ndk, but instead of being in the app, I get the same error with a library, I try to add the prebuild, but the error also jumps

  • What went wrong:
    Execution failed for task ':react-native-epson-epos-printer:stripReleaseDebugSymbols'.

No version of NDK matched the requested version 21.0.6113669. Versions available locally: 21.4.7075529, 23.2.8568313, 24.0.8215888

@lucioreyli
Copy link
Author

Are you trying to build at AppCenter?

@lucioreyli
Copy link
Author

You can try add this on source project as appcenter-pre-build.sh

# Set NDK version to download - r21
if [ "$APPCENTER_ANDROID_MODULE" ]
then 
  SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
  echo y | $SDKMANAGER "ndk;21.0.6113669"
fi
# Show what's version is available
echo 'Available NDK versions:'
ls $ANDROID_HOME/ndk

@NoelMiranda1
Copy link

¿Está tratando de construir en AppCenter?

if [ "$APPCENTER_ANDROID_MODULE" ]
then 
  SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
  echo y | $SDKMANAGER "ndk;21.0.6113669"
fi
# Show what's version is available
echo 'Available NDK versions:'
ls $ANDROID_HOME/ndk

should it look like this?

if [ "react-native-epson-epos-printer" ]
then
SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
echo and | $SDKMANAGER "ndk;21.0.6113669"
fi

@lucioreyli
Copy link
Author

No. The $APPCENTER_ANDROID_MODULE is a enviroment variable predefined by AppCenter and you should not replace. You just need copy and paste the code above to install the version that your package needs. The $APPCENTER_ANDROID_MODULE only exists during Android build and the default value is “app”.
Pre-Defined variables - App Center Docs

@NoelMiranda1
Copy link

I have received this error message already with the configuration provided before the prebuild

Exception in thread "main" javax.net.ssl.SSLException: readHandshakeRecord
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1314)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:197)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1572)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1500)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
at org.gradle.wrapper.Download.downloadInternal(Download.java:67)
at org.gradle.wrapper.Download.download(Download.java:52)
at org.gradle.wrapper.Install$1.call(Install.java:62)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
Suppressed: java.net.SocketException: Broken pipe (Write failed)
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:355)
at sun.security.ssl.TransportContext.fatal(TransportContext.java:267)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:443)
... 13more
Caused by: java.net.SocketException: Broken pipe (Write failed)
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at sun.security.ssl.SSLSocketOutputRecord.encodeChangeCipherSpec(SSLSocketOutputRecord.java:221)
at sun.security.ssl.OutputRecord.changeWriteCiphers(OutputRecord.java:162)
at sun.security.ssl.ChangeCipherSpec$T10ChangeCipherSpecProducer.produce(ChangeCipherSpec.java:118)
at sun.security.ssl.Finished$T12FinishedProducer.onProduceFinished(Finished.java:390)
at sun.security.ssl.Finished$T12FinishedProducer.produce(Finished.java:374)
at sun.security.ssl.SSLHandshake.produce(SSLHandshake.java:421)
at sun.security.ssl.ServerHelloDone$ServerHelloDoneConsumer.consume(ServerHelloDone.java:182)
at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:377)
at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422)
at sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
at sun.security.ssl.SSLTransport.decode(SSLTransport.java:152)
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1397)
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1305)
... 14more
Error: /Users/runner/work/1/s/android/gradlew failed with return code: 1
at ChildProcess. (/Users/runner/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 Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
##[error]Error: /Users/runner/work/1/s/android/gradlew failed with return code: 1

@NoelMiranda1
Copy link

I tried one more time and got the error again

  • What went wrong:
    Execution failed for task ':react-native-epson-epos-printer:stripReleaseDebugSymbols'.

No version of NDK matched the requested version 21.0.6113669. Versions available locally: 21.4.7075529, 23.2.8568313, 24.0.8215888

this is what the pre-build looks like

SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
echo and | $SDKMANAGER "ndk;21.0.6113669"

if [ "$APPCENTER_ANDROID_MODULE" ]
then
SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
echo and | $SDKMANAGER "ndk;21.0.6113669"
fi

Show what's version is available

echo 'Available NDK versions:'
ls $ANDROID_HOME/ndk

No. The $APPCENTER_ANDROID_MODULE is a enviroment variable predefined by AppCenter and you should not replace. You just need copy and paste the code above to install the version that your package needs. The $APPCENTER_ANDROID_MODULE only exists during Android build and the default value is “app”. Pre-Defined variables - App Center Docs

@lucioreyli
Copy link
Author

But the NDK is downloading? You can try this removing IF syntax, just put the body inside if, like:

# Set NDK version to download - r21  
SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
echo y | $SDKMANAGER "ndk;21.0.6113669"

@NoelMiranda1
Copy link

Screenshot_2022-08-01_17-48-56

After removing the IF I have received the same message

the prebuild.sh is like this
SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
echo and | $SDKMANAGER "ndk;21.0.6113669"

Show what's version is available

echo 'Available NDK versions:'
ls $ANDROID_HOME/ndk

@NoelMiranda1
Copy link

But the NDK is downloading? You can try this removing IF syntax, just put the body inside if, like:

# Set NDK version to download - r21  
SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
echo y | $SDKMANAGER "ndk;21.0.6113669"

.

@lucioreyli
Copy link
Author

What is the name of the file? The name need be appcenter-pre-build.sh, like this example project (ignore the missing files, is only a example):
Captura de Tela 2022-08-02 às 08 44 18 2

So you can check if the file exists at App Center AT A BRANCH WITH THIS FILE THAT YOU CREATED. Im my case, I just have one "App center build script", to run during pre-build.
Captura de Tela 2022-08-02 às 08 49 40
When you push this file to your branch check if show at AppCenter in first information box "Build app".

@NoelMiranda1
Copy link

Hello, if everything is like this, I have only removed the IF
Screenshot_2022-08-02_07-12-20
Screenshot_2022-08-02_07-12-50

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants