facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.26k stars 24.34k forks source link

Can not upgrade from RN 0.68.0 to RN 0.69.0 #34099

Closed chengjunzhang1219 closed 1 year ago

chengjunzhang1219 commented 2 years ago

Description

While was upgrading the react-native version to 0.69.0, I am getting this errors.

CMake Deprecation Warning at CMakeLists.txt:42 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using  /mobile/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt: Build command failed.
  Error while executing process /Users/a123/Library/Android/sdk/cmake/3.18.1/bin/cmake with arguments {-H /mobile/node_modules/react-native/ReactAndroid/src/main/jni -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=21 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DANDROID_NDK=/Users/a123/Library/Android/sdk/ndk/24.0.8215888 -DCMAKE_ANDROID_NDK=/Users/a123/Library/Android/sdk/ndk/24.0.8215888 -DCMAKE_TOOLCHAIN_FILE=/Users/a123/Library/Android/sdk/ndk/24.0.8215888/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/a123/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_LIBRARY_OUTPUT_DIRECTORY= /mobile/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/2a1ua11n/obj/arm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY= /mobile/node_modules/react-native/ReactAndroid/build/intermediates/cxx/Debug/2a1ua11n/obj/arm64-v8a -DCMAKE_BUILD_TYPE=Debug -DCMAKE_FIND_ROOT_PATH= /mobile/node_modules/react-native/ReactAndroid/.cxx/Debug/2a1ua11n/prefab/arm64-v8a/prefab -B /mobile/node_modules/react-native/ReactAndroid/.cxx/Debug/2a1ua11n/arm64-v8a -GNinja -DREACT_COMMON_DIR= /mobile/node_modules/react-native/ReactCommon -DREACT_ANDROID_DIR= /mobile/node_modules/react-native/ReactAndroid -DANDROID_STL=c++_shared -DANDROID_TOOLCHAIN=clang -DANDROID_PLATFORM=android-21}
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Users/a123/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Users/a123/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring incomplete, errors occurred!
  See also " /mobile/node_modules/react-native/ReactAndroid/.cxx/Debug/2a1ua11n/arm64-v8a/CMakeFiles/CMakeOutput.log".

  CMake Warning at /Users/a123/Library/Android/sdk/ndk/24.0.8215888/build/cmake/android-legacy.toolchain.cmake:415 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    /Users/a123/Library/Android/sdk/ndk/24.0.8215888/build/cmake/android.toolchain.cmake:54 (include)
    /Users/a123/Library/Android/sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include)
    CMakeLists.txt:9 (project)

  CMake Warning at /Users/a123/Library/Android/sdk/ndk/24.0.8215888/build/cmake/android-legacy.toolchain.cmake:415 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    /Users/a123/Library/Android/sdk/ndk/24.0.8215888/build/cmake/android.toolchain.cmake:54 (include)
     /mobile/node_modules/react-native/ReactAndroid/.cxx/Debug/2a1ua11n/arm64-v8a/CMakeFiles/3.18.1-g262b901/CMakeSystem.cmake:6 (include)
     /mobile/node_modules/react-native/ReactAndroid/.cxx/Debug/2a1ua11n/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

  CMake Warning at /Users/a123/Library/Android/sdk/ndk/24.0.8215888/build/cmake/android-legacy.toolchain.cmake:415 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    /Users/a123/Library/Android/sdk/ndk/24.0.8215888/build/cmake/android.toolchain.cmake:54 (include)
     /mobile/node_modules/react-native/ReactAndroid/.cxx/Debug/2a1ua11n/arm64-v8a/CMakeFiles/3.18.1-g262b901/CMakeSystem.cmake:6 (include)
     /mobile/node_modules/react-native/ReactAndroid/.cxx/Debug/2a1ua11n/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

  CMake Error at CMakeLists.txt:16 (add_subdirectory):
    The source directory

      /mobile/node_modules/react-native/ReactAndroid/build/third-party-ndk/glog

    does not contain a CMakeLists.txt file.
  Call Stack (most recent call first):
    CMakeLists.txt:20 (add_react_android_subdir)
    CMakeLists.txt:31 (add_react_third_party_ndk_subdir)

  CMake Error at CMakeLists.txt:16 (add_subdirectory):
    The source directory

      /mobile/node_modules/react-native/ReactAndroid/build/third-party-ndk/boost

    does not contain a CMakeLists.txt file.
  Call Stack (most recent call first):
    CMakeLists.txt:20 (add_react_android_subdir)
    CMakeLists.txt:32 (add_react_third_party_ndk_subdir)

  CMake Error at CMakeLists.txt:16 (add_subdirectory):
    The source directory

      /mobile/node_modules/react-native/ReactAndroid/build/third-party-ndk/libevent

    does not contain a CMakeLists.txt file.
  Call Stack (most recent call first):
    CMakeLists.txt:20 (add_react_android_subdir)
    CMakeLists.txt:35 (add_react_third_party_ndk_subdir)

  CMake Error at CMakeLists.txt:16 (add_subdirectory):
    The source directory

      /mobile/node_modules/react-native/ReactAndroid/build/third-party-ndk/jsc

    does not contain a CMakeLists.txt file.
  Call Stack (most recent call first):
    CMakeLists.txt:20 (add_react_android_subdir)
    CMakeLists.txt:37 (add_react_third_party_ndk_subdir)

I followed the react-native-upgrade-helper so updated the project gradle and android app gradle files. But when run on android device, i am getting this error. PS: i tried to reproduce this issue on new project but new one does work.

I am not sure what i missed while upgrade the version.

Could you please someone help me?

Version

0.69.0

Output of npx react-native info

System: OS: macOS 12.1 CPU: (8) arm64 Apple M1 Memory: 106.08 MB / 8.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v16.15.1/bin/yarn npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm Watchman: 2022.06.13.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/lib/ruby/gems/3.0.0/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 Android SDK: API Levels: 23, 28, 29, 30, 31 Build Tools: 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.1.0 System Images: android-31 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8309675 Xcode: 13.1/13A1030d - /usr/bin/xcodebuild Languages: Java: 11.0.13 - /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/home/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.0 => 0.69.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

After upgrade the version, and run on android, getting above error.

Snack, code example, screenshot, or link to a repository

Screenshot 2022-06-29 at 10 46 09 PM Screenshot 2022-06-29 at 10 46 48 PM
cortinico commented 2 years ago

PS: i tried to reproduce this issue on new project but new one does work.

You probably missed some setup in your settings.gradle or build.gradle. The issue is that glog sources + CMake files are not configured correctly so the build is failing to find the insutrctions on how to build it.

If you could share a reproducer, I could tell you what is missing

github-actions[bot] commented 2 years ago
:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.
chengjunzhang1219 commented 2 years ago

@cortinico Thanks I will share my gradle files

chengjunzhang1219 commented 2 years ago

Setting gradle

rootProject.name = 'mobile'
include     ':app',
            ':libsharecomponent',
            ':libscreensharing'

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

includeBuild('../node_modules/react-native-gradle-plugin')
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
    include(":ReactAndroid")
    project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
    include(":ReactAndroid:hermes-engine")
    project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
}

Build gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.5.32'
    ext.RNNKotlinVersion = '1.5.32'
    ext.lifecycle_version = '1.1.1'
    ext.gson_version = '2.0.1'
    ext.gradle_version = '7.1.1'
    ext.google_service_version = '4.3.8'
    ext.androidautoversion = '3.3.0'

    ext {
        kotlinVersion = '1.5.32'
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31
        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = "21.4.7075529"
        }
        supportLibVersion = "28.0.0"
        constraintLayoutVersion = "1.1.2"
        sdpVersion = "1.0.6"
        butterKnife = "8.4.0"
        glideVersion = "4.9.0"
        glideTransformationVersion = "2.0.1"
        gpuimageVersion = "2.0.0"
        googlePlayServicesVersion = "+"
        firebaseMessagingVersion = "+"
        config = [
                'build-tools'    : "31.0.0",
                'compile-sdk'    : 31,
                'target-sdk'     : 31,
                'min-sdk'        : 21,
                'push-aar-gradle': 'https://raw.githubusercontent.com/noties/gradle-mvn-push/master/gradle-mvn-push-aar.gradle'
        ]
        rxjava2Version = '2.1.9'
        rxandroidVersion = '2.0.1'
        coroutinesVersion = '1.1.1'
        retrofitVersion = '2.5.0'
        coroutinesAdapterVersion = '0.9.2'
        fragment_version = '1.3.6'
        markwon_version = '4.6.2'
    }
    repositories {
        google()
        jcenter()
        mavenLocal()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:$gradle_version")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:5.0.1")
        classpath("com.github.alexfu:androidautoversion:${androidautoversion}")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "com.google.gms:google-services:$google_service_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/jsc-android/dist"
        }
        mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }
        google()
        maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com" }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    }
}

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (names.contains("reactNative51") ||
                            names.contains("reactNative55") ||
                            names.contains("reactNative56") ||
                            names.contains("reactNative57") ||
                            names.contains("reactNative57_5") ||
                            names.contains("reactNative57WixFork") ||
                            names.contains("reactNative57Wix") ||
                            names.contains("reactNative60") ||
                            names.contains("reactNative61") ||
                            names.contains("reactNative62") ||
                            names.contains("reactNative63")) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "31.0.0"
            }
        }
    }
}

App build gradle

apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.github.alexfu.androidautoversion'
project.ext.envConfigFiles = [
        debug             : ".env",
        release           : ".env",
        anothercustombuild: ".env",
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation. If none specified and
 *   // "index.android.js" exists, it will be used. Otherwise "index.js" is
 *   // default. Can be overridden with ENTRY_FILE environment variable.
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    enableHermes: true,  // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

react {
    libraryName = "android_app"
    codegenJavaPackageName = "android"
    jsRootDir = rootProject.file("../app/")
}

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on    ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and that value will be read here. If it is not set
 * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
 * and the benefits of using Hermes will therefore be sharply reduced.
 */
def enableHermes = project.ext.react.get("enableHermes", true)

/**
 * Architectures to build native code for in debug.
 */
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")

/**
 * Architectures to build native code for.
 */
def reactNativeArchitectures() {
    def value = project.getProperties().get("reactNativeArchitectures")
    return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

android {
    ndkVersion rootProject.ext.ndkVersion
    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId "com.android"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        missingDimensionStrategy "RNN.reactNativeVersion", "reactNative68"
        versionName androidAutoVersion.versionName
        versionCode androidAutoVersion.versionCode
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        resValue "string", "build_config_package", "com.android"
        buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

        if (isNewArchitectureEnabled()) {
            externalNativeBuild {
                ndkBuild {
                    arguments "APP_PLATFORM=android-21",
                            "APP_STL=c++_shared",
                            "NDK_TOOLCHAIN_VERSION=clang",
                            "GENERATED_SRC_DIR=$buildDir/generated/source",
                            "PROJECT_BUILD_DIR=$buildDir",
                            "REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
                            "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
                            "NODE_MODULES_DIR=$rootDir/../node_modules"
                    cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
                    cppFlags "-std=c++17"
                    targets "android_appmodules"
                }
            }
            if (!enableSeparateBuildPerCPUArchitecture) {
                ndk {
                    abiFilters (*reactNativeArchitectures())
                }
            }
        }
    }
    if (isNewArchitectureEnabled()) {

        externalNativeBuild {
            ndkBuild {
                path "$projectDir/src/main/jni/Android.mk"
            }
        }
        def reactAndroidProjectDir = project(':ReactAndroid').projectDir
        def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
            dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
            from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
            into("$buildDir/react-ndk/exported")
        }
        def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
            dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
            from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
            into("$buildDir/react-ndk/exported")
        }
        afterEvaluate {
            preDebugBuild.dependsOn(packageReactNdkDebugLibs)
            preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
            configureNdkBuildRelease.dependsOn(preReleaseBuild)
            configureNdkBuildDebug.dependsOn(preDebugBuild)
            reactNativeArchitectures().each { architecture ->
                tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
                    dependsOn("preDebugBuild")
                }
                tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
                    dependsOn("preReleaseBuild")
                }
            }
        }
    }

    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libjsc.so'
        pickFirst 'lib/arm64-v8a/libjsc.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
        pickFirst '**/lib**.so'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildFeatures {

        dataBinding = true
        // for view binding:
        // viewBinding = true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk true  // If true, also generate a universal APK
            include (*reactNativeArchitectures())
        }
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        defaultConfig.versionCode * 1000 + versionCodes.get(abi)
            }
        }
    }

    signingConfigs {
        release {
            // You need to specify either an absolute path or include the
            // keystore file in the same directory as the build.gradle file.
        }
    }
    buildTypes {
        debug {
            if (nativeArchitectures) {
                ndk {
                    abiFilters nativeArchitectures.split(',')
                }
            }
        }
        release {
            minifyEnabled enableProguardInReleaseBuilds
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation project(":ReactAndroid")  // From node_modules
    implementation("com.android.support:multidex:2.0.1")
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    implementation 'com.facebook.fresco:fresco:2.3.0'
    implementation 'com.facebook.fresco:animated-base-support:1.0.0'
    implementation 'com.facebook.fresco:animated-gif:2.3.0'
    implementation 'com.facebook.fresco:animated-webp:2.3.0'
    implementation 'com.facebook.fresco:webpsupport:2.3.0'
    implementation 'com.facebook.stetho:stetho:1.5.0'
    implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
    implementation 'com.sackcentury:shinebutton:1.0.0'

    // Agora
//    implementation "io.agora.rtc:full-sdk:3.5.0"
    implementation project(path: ':libscreensharing')

    //Bar chart
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    //noinspection GradleDynamicVersion

    debugImplementation 'com.facebook.soloader:soloader:0.10.1'

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    implementation "com.android.support.constraint:constraint-layout:${rootProject.ext.constraintLayoutVersion}"
    implementation "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
    //Dimension lib
    implementation "com.intuit.sdp:sdp-android:${rootProject.ext.sdpVersion}"
    implementation "com.intuit.ssp:ssp-android:${rootProject.ext.sdpVersion}"

    // Pinch zoom imageview
    implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'

    // kotlin and lifecycle extensions
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"

    configurations.all {
        exclude group: 'org.jetbrains', module: 'annotations-java5'
    }

    //Markdown parser
    implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'

    // decode and encode emoji
    implementation 'org.apache.commons:commons-lang3:3.4'

    // emoji compat
    implementation "com.android.support:support-emoji:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:support-emoji-bundled:${rootProject.ext.supportLibVersion}"

    implementation 'com.github.duanhong169:drawabletoolbox:1.0.7'
    implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.3.0'

    // reactive
    implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava2Version"
    implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxandroidVersion"
    implementation 'com.karumi:dexter:4.2.0'

    implementation 'me.relex:circleindicator:2.1.6'

    // Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutinesVersion"

    // Retrofit and coroutine adapter
    implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
    implementation "com.squareup.retrofit2:converter-moshi:$rootProject.retrofitVersion"
    implementation "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:$rootProject.coroutinesAdapterVersion"
    implementation 'com.squareup.okhttp3:logging-interceptor:3.13.1'
    implementation 'com.kaopiz:kprogresshud:1.2.0'
    implementation 'com.github.florent37:viewtooltip:1.1.6'
    implementation 'com.jiajunhui.xapp.medialoader:medialoader:1.2.1'
    implementation 'com.github.hyuwah:DraggableView:1.0.0'
    // Fragment
    implementation "androidx.fragment:fragment:$rootProject.fragment_version"
    implementation "androidx.fragment:fragment-ktx:$rootProject.fragment_version"

    implementation 'com.github.chengjunzhang1219:Markwon:v4.6.2.12'

    //keyboard event
    implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:3.0.0-RC3'

    if (enableHermes) {
        implementation("com.facebook.react:hermes-engine:+") { // From node_modules
            exclude group:'com.facebook.fbjni'
        }
    } else {
        implementation jscFlavor
    }

}

if (isNewArchitectureEnabled()) {
    configurations.all {
        resolutionStrategy.dependencySubstitution {
            substitute(module("com.facebook.react:react-native"))
                    .using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
            substitute(module("com.facebook.react:hermes-engine"))
                    .using(project(":ReactAndroid:hermes-engine"))
                    .because("On New Architecture we're building Hermes from source")
        }
    }
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.implementation
    into 'libs'
}
repositories {
    maven { url "https://jitpack.io" }
    mavenCentral()
}

apply plugin: 'com.google.gms.google-services'
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

def isNewArchitectureEnabled() {
    // To opt-in for the New Architecture, you can either:
    // - Set `newArchEnabled` to true inside the `gradle.properties` file
    // - Invoke gradle with `-newArchEnabled=true`
    // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
    return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}
cortinico commented 2 years ago

At a first glance, your setup looks correct. I'm not sure what is preventing your build setup from downloading the third party sources.

To help me debug further, a reproducer project would be extremely useful.

chengjunzhang1219 commented 2 years ago

@cortinico Thank you 👍 Sorry i can not share the project. I am not quite sure what is the issue in my settings. Could anyone please check this?

cortinico commented 2 years ago

Could anyone please check this?

Only if you could share a reproducer, that we can run locally. Looking at just the .gradle file is not sufficient to tell what's going on now (as they look fine to me).

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.