skip to Main Content

I’m currently working on a react native project and I have recently updated expo from 48 to 51 and gradle from 8.0 to 8.7 but I’ve been running into a lot of issues while building and I don’t understand what’s happening. If anyone has any idea please let me know

current configuration

// android => build.gradle

buildscript {
    ext {
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '24')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '33')
        kotlinVersion = findProperty('android.kotlinVersion') ?: '1.8.10'
        frescoVersion = findProperty('expo.frescoVersion') ?: '2.5.0'
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:8.7')
        classpath('com.facebook.react:react-native-gradle-plugin')
    }
}

allprojects {
    repositories {
        maven {
            url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
        }
        maven {
            url(new File(['node', '--print', "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), '../dist'))
        }

        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}

When I run the command below, it starts building but then get a lot of errors

eas build --platform android

List of errors

FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':expo-modules-core:buildCMakeRelWithDebInfo[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/home/expo/workingdir/build/node_modules/expo-modules-core/android/.cxx/RelWithDebInfo/44jo3q1u/arm64-v8a'
  [1/31] Building CXX object CMakeFiles/expo-modules-core.dir/home/expo/workingdir/build/node_modules/expo-modules-core/common/cpp/NativeModule.cpp.o
  [2/31] Building CXX object CMakeFiles/expo-modules-core.dir/home/expo/workingdir/build/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o
  [3/31] Building CXX object CMakeFiles/expo-modules-core.dir/home/expo/workingdir/build/node_modules/expo-modules-core/common/cpp/ObjectDeallocator.cpp.o
  [4/31] Building CXX object CMakeFiles/expo-modules-core.dir/home/expo/workingdir/build/node_modules/expo-modules-core/common/cpp/SharedObject.cpp.o
  [5/31] Building CXX object CMakeFiles/expo-modules-core.dir/home/expo/workingdir/build/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o
  [6/31] Building CXX object CMakeFiles/expo-modules-core.dir/home/expo/workingdir/build/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o
  [7/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIDeallocator.cpp.o
  [8/31] Building CXX object CMakeFiles/expo-modules-core.dir/home/expo/workingdir/build/node_modules/expo-modules-core/common/cpp/EventEmitter.cpp.o
  [9/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIInjector.cpp.o
  [10/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/Exceptions.cpp.o
  [11/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIFunctionBody.cpp.o
  [12/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/ExpoModulesHostObject.cpp.o
  [13/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/types/FrontendConverterProvider.cpp.o
  [14/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaReferencesCache.cpp.o
  [15/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JSReferencesCache.cpp.o
  [16/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptFunction.cpp.o
  [17/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIContext.cpp.o
  [18/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o
  FAILED: CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o 
  /home/expo/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/home/expo/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dexpo_modules_core_EXPORTS -I/home/expo/.gradle/caches/transforms-4/1b0d40195752a48d3828f4fabd5bb28b/transformed/jetified-react-android-0.74.1-release/prefab/modules/reactnativejni/include/react -I/home/expo/workingdir/build/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/home/expo/workingdir/build/node_modules/expo-modules-core/android/../common/cpp -I/home/expo/workingdir/build/node_modules/expo-modules-core/android/src/fabric -isystem /home/expo/.gradle/caches/transforms-4/ecfdad561a37bc96224ca22b4a190131/transformed/jetified-fbjni-0.6.0/prefab/modules/fbjni/include -isystem /home/expo/.gradle/caches/transforms-4/1b0d40195752a48d3828f4fabd5bb28b/transformed/jetified-react-android-0.74.1-release/prefab/modules/jsi/include -isystem /home/expo/.gradle/caches/transforms-4/1b0d40195752a48d3828f4fabd5bb28b/transformed/jetified-react-android-0.74.1-release/prefab/modules/reactnativejni/include -isystem /home/expo/.gradle/caches/transforms-4/1b0d40195752a48d3828f4fabd5bb28b/transformed/jetified-react-android-0.74.1-release/prefab/modules/folly_runtime/include -isystem /home/expo/.gradle/caches/transforms-4/1b0d40195752a48d3828f4fabd5bb28b/transformed/jetified-react-android-0.74.1-release/prefab/modules/react_nativemodule_core/include -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -DREACT_NATIVE_TARGET_VERSION=74 -O2 -g -DNDEBUG -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -O2 -frtti -fexceptions -Wall -fstack-protector-all -DUSE_HERMES=0 -DUNIT_TEST=0 -std=gnu++20 -MD -MT CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o -MF CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o.d -o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o -c /home/expo/workingdir/build/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp
  /home/expo/workingdir/build/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp:148:28: error: no viable constructor or deduction guide for deduction of template arguments of 'weak_ptr'
      auto weakConstructor = std::weak_ptr(constructor);
                             ^
  /home/expo/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4690:51: note: candidate template ignored: couldn't infer template argument '_Tp'
      template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(shared_ptr<_Yp> const& __r,
                                                    ^
  /home/expo/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4679:28: note: candidate template ignored: could not match 'weak_ptr' against 'shared_ptr'
  class _LIBCPP_TEMPLATE_VIS weak_ptr
                             ^
  /home/expo/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4694:5: note: candidate template ignored: could not match 'weak_ptr' against 'shared_ptr'
      weak_ptr(weak_ptr const& __r) _NOEXCEPT;
      ^
  /home/expo/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4695:51: note: candidate template ignored: could not match 'weak_ptr' against 'shared_ptr'
      template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp> const& __r,
                                                    ^
  /home/expo/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4701:5: note: candidate template ignored: could not match 'weak_ptr' against 'shared_ptr'
      weak_ptr(weak_ptr&& __r) _NOEXCEPT;
      ^
  /home/expo/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4702:51: note: candidate template ignored: could not match 'weak_ptr' against 'shared_ptr'
      template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp>&& __r,
                                                    ^
  /home/expo/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4689:23: note: candidate function template not viable: requires 0 arguments, but 1 was provided
      _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
                        ^
  1 error generated.
  [19/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptRuntime.cpp.o
  [20/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptObject.cpp.o
  [21/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaCallback.cpp.o
  [22/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptTypedArray.cpp.o
  [23/31] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptValue.cpp.o
  ninja: build stopped: subcommand failed.
  
  C++ build system [build] failed while executing:
      /home/expo/Android/Sdk/cmake/3.22.1/bin/ninja 
        -C 
        /home/expo/workingdir/build/node_modules/expo-modules-core/android/.cxx/RelWithDebInfo/44jo3q1u/arm64-v8a 
        expo-modules-core
    from /home/expo/workingdir/build/node_modules/expo-modules-core/android
* 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 7m 16s
568 actionable tasks: 568 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

2

Answers


  1. //allprojects{} should be inside buildscripts

    buildscript {
            ext {
                buildToolsVersion = "34.0.0"
                minSdkVersion = 23
                compileSdkVersion = 34
                targetSdkVersion = 34
                ndkVersion = "25.1.8937393" 
                kotlinVersion = "1.9.22"
            }
            repositories {
                google()
                mavenCentral()
            }
            dependencies {
                classpath("com.android.tools.build:gradle")
                classpath("com.facebook.react:react-native-gradle-plugin")
                classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
                classpath("com.google.gms:google-services:4.4.1")       
                
            }
        
            allprojects{
                repositories {
                    maven {
                        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                        url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
                    }
                    maven {
                        // expo-camera bundles a custom com.google.android:cameraview
                        url "$rootDir/../node_modules/expo-camera/android/maven"
                    }
        
                }
            }
        
            
        }
        
        apply plugin: "com.facebook.react.rootproject"
    
    Login or Signup to reply.
  2. That is a known software error that will be fixed in a release soon. https://github.com/expo/expo/commit/da05e4720417ddd8fcf19f392fb5914deba2bcb5

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search