androidreact-nativendk-buildvisual-studio-app-center-distribute

Appcenter android build fails to install in device


I have configured my react-native app in appcenter for build and distribution. Everything was working fine and all of a sudden, build failed with the following error

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

Followed this link https://github.com/microsoft/appcenter/issues/2144 and updated my grade file to

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

and gradle-wrapper.properties to

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

after this the build worked but the app distributed after the build failed to installed on devices with "App Not Installed" error. I tried different versions and no success so far.


Solution

  • I was able to fix the issue with the following settings

    in graddle-wrapper.properties updated the distributionUrl to

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

    in android/build.gradle updated gradle version to

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

    Updated react-native version to 0.65.1

    npm i react-native@0.65.1
    
    

    updated all related packages to be compatible with this react-native version

    npm update "react-native"
    
    

    after this, I was able to build it in appcenter and was able to distribute and install the app