2

我已经在 appcenter 中配置了我的 react-native 应用程序以进行构建和分发。一切正常,突然之间,构建失败并出现以下错误

> Task :app:stripReleaseDebugSymbols FAILED
Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.

> Task :app:mergeExtDexRelease

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

* 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.

按照此链接https://github.com/microsoft/appcenter/issues/2144并将我的成绩文件更新为

buildscript {
    ext {
        ndkVersion = "20.1.5948944"
    }
    
    dependencies {
        classpath("com.android.tools.build:gradle:4.1.0")
   }

和 gradle-wrapper.properties 到

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

在此之后构建工作,但构建后分发的应用程序无法安装在设备上并出现“未安装应用程序”错误。我尝试了不同的版本,但到目前为止没有成功。

4

2 回答 2

3

我能够通过以下设置解决问题

在 graddle-wrapper.properties 中将 distributionUrl 更新为

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

在 android/build.gradle 中将 gradle 版本更新为

classpath("com.android.tools.build:gradle:4.2.0")

将 react-native 版本更新为 0.65.1

npm i react-native@0.65.1

更新了所有相关的包以与这个 react-native 版本兼容

npm update "react-native"

在此之后,我能够在 appcenter 中构建它并能够分发和安装该应用程序

于 2021-10-27T09:15:45.310 回答
0

有类似的问题。在通过查看构建日志检查了 VSAC 支持哪些 ndk 版本后,我android/build.gradle使用以下 ndk 版本进行了更新并且它工作正常。

buildscript {
    ext {
        ...
        ndkVersion = "18.1.5063045"
    }
    ...
}

于 2021-10-19T08:08:29.437 回答