react-native
react-native copied to clipboard
Android Build Failure: Error when building with cmake
Description
Recently we migrated the app to 0.72.1 from 0.68.0 with New Architecture, earlier we used to get cmake error for android but we were able to fix those either upgrading Gradle or cleaning build folder, so now the debug build works fine but still getting same issues with release build with command
/bin/bash gradlew assembleRelease
> Task :@react-native-community_netinfo:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :@react-native-community_netinfo:mergeReleaseGeneratedProguardFiles
> Task :@react-native-community_netinfo:mergeReleaseConsumerProguardFiles
> Task :@react-native-community_netinfo:syncReleaseLibJars
> Task :@react-native-community_netinfo:bundleReleaseAar
> Task :@react-native-community_netinfo:mapReleaseSourceSetPaths
> Task :@react-native-async-storage_async-storage:verifyReleaseResources
> Task :@react-native-community_netinfo:mergeReleaseResources
> Task :@react-native-async-storage_async-storage:assembleRelease
> Task :@react-native-async-storage_async-storage:copyReleaseJniLibsProjectOnly
> Task :@react-native-community_netinfo:copyReleaseJniLibsProjectOnly
> Task :app:buildCodegenCLI SKIPPED
> Task :app:generateCodegenSchemaFromJavaScript SKIPPED
> Task :app:generateCodegenArtifactsFromSchema SKIPPED
> Task :app:generateNewArchitectureFiles
> Task :app:generatePackageList
> Task :app:preBuild
> Task :app:preNormalReleaseBuild
> Task :@react-native-community_netinfo:verifyReleaseResources
> Task :app:configureCMakeRelWithDebInfo[arm64-v8a] FAILED
C/C++: CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:6 (add_subdirectory):
C/C++: add_subdirectory given source
C/C++: "/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/@react-native-community/datetimepicker/android/build/generated/source/codegen/jni/"
C/C++: which is not an existing directory.
C/C++: Call Stack (most recent call first):
C/C++: /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
C/C++: CMakeLists.txt:31 (include)
C/C++: CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:7 (add_subdirectory):
C/C++: add_subdirectory given source
C/C++: "/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native-gesture-handler/android/build/generated/source/codegen/jni/"
C/C++: which is not an existing directory.
C/C++: Call Stack (most recent call first):
C/C++: /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
C/C++: CMakeLists.txt:31 (include)
C/C++: CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:8 (add_subdirectory):
C/C++: add_subdirectory given source
C/C++: "/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native-image-picker/android/build/generated/source/codegen/jni/"
C/C++: which is not an existing directory.
C/C++: Call Stack (most recent call first):
C/C++: /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
C/C++: CMakeLists.txt:31 (include)
C/C++: CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:11 (add_subdirectory):
C/C++: add_subdirectory given source
C/C++: "/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native-webview/android/build/generated/source/codegen/jni/"
C/C++: which is not an existing directory.
C/C++: Call Stack (most recent call first):
C/C++: /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
C/C++: CMakeLists.txt:31 (include)
C/C++: CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:124 (target_link_libraries):
C/C++: Cannot specify link libraries for target
C/C++: "react_codegen_RNDateTimePickerCGen" which is not built by this project.
C/C++: Call Stack (most recent call first):
C/C++: CMakeLists.txt:31 (include)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:configureCMakeRelWithDebInfo[arm64-v8a]'.
> [CXX1429] error when building with cmake using /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/CMakeLists.txt: -- The C compiler identification is Clang 12.0.8
-- The CXX compiler identification is Clang 12.0.8
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/****/Library/Android/sdk/ndk/23.1.7779620/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/****/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring incomplete, errors occurred!
See also "/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/.cxx/RelWithDebInfo/434p654o/arm64-v8a/CMakeFiles/CMakeOutput.log".
C++ build system [configure] failed while executing:
/Users/****/Library/Android/sdk/cmake/3.22.1/bin/cmake \
-H/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_SYSTEM_VERSION=21 \
-DANDROID_PLATFORM=android-21 \
-DANDROID_ABI=arm64-v8a \
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DANDROID_NDK=/Users/****/Library/Android/sdk/ndk/23.1.7779620 \
-DCMAKE_ANDROID_NDK=/Users/****/Library/Android/sdk/ndk/23.1.7779620 \
-DCMAKE_TOOLCHAIN_FILE=/Users/****/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake \
-DCMAKE_MAKE_PROGRAM=/Users/****/Library/Android/sdk/cmake/3.22.1/bin/ninja \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/intermediates/cxx/RelWithDebInfo/434p654o/obj/arm64-v8a \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/intermediates/cxx/RelWithDebInfo/434p654o/obj/arm64-v8a \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_FIND_ROOT_PATH=/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/.cxx/RelWithDebInfo/434p654o/prefab/arm64-v8a/prefab \
-B/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/.cxx/RelWithDebInfo/434p654o/arm64-v8a \
-GNinja \
-DPROJECT_BUILD_DIR=/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build \
-DREACT_ANDROID_DIR=/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid \
-DANDROID_STL=c++_shared \
-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=ON
from /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app
CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:6 (add_subdirectory):
add_subdirectory given source
"/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/@react-native-community/datetimepicker/android/build/generated/source/codegen/jni/"
which is not an existing directory.
Call Stack (most recent call first):
/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
CMakeLists.txt:31 (include)
CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:7 (add_subdirectory):
add_subdirectory given source
"/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native-gesture-handler/android/build/generated/source/codegen/jni/"
which is not an existing directory.
Call Stack (most recent call first):
/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
CMakeLists.txt:31 (include)
CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:8 (add_subdirectory):
add_subdirectory given source
"/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native-image-picker/android/build/generated/source/codegen/jni/"
which is not an existing directory.
Call Stack (most recent call first):
/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
CMakeLists.txt:31 (include)
CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:11 (add_subdirectory):
add_subdirectory given source
"/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native-webview/android/build/generated/source/codegen/jni/"
which is not an existing directory.
Call Stack (most recent call first):
/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
CMakeLists.txt:31 (include)
CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:124 (target_link_libraries):
Cannot specify link libraries for target
"react_codegen_RNDateTimePickerCGen" which is not built by this project.
Call Stack (most recent call first):
CMakeLists.txt:31 (include)
* 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/
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 44s
85 actionable tasks: 85 executed
rake aborted!
FAILED TO EXECUTE COMMAND => /bin/bash gradlew assembleRelease
/Users//JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/includes/utils.rb:13:in block in safe_sh' /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/includes/utils.rb:11:in
safe_sh'
/Users//JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/Rakefile.rb:232:in block (2 levels) in <top (required)>' /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/Rakefile.rb:214:in
chdir'
/Users//JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/Rakefile.rb:214:in block in <top (required)>' /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/Rakefile.rb:146:in
block (2 levels) in <top (required)>'
/Users//JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/Rakefile.rb:91:in chdir' /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/Rakefile.rb:91:in
block in <top (required)>'
Tasks: TOP => build_android
Please suggest if need to do any additional changes on Jenkins setup, Thanks
React Native Version
0.72.1
Output of npx react-native info
System: OS: macOS 13.4 CPU: (12) arm64 Apple M2 Pro Memory: 414.14 MB / 32.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 16.20.0 path: /usr/local/bin/node Yarn: version: 1.22.19 path: /opt/homebrew/bin/yarn npm: version: 8.19.4 path: /usr/local/bin/npm Watchman: version: 2023.06.26.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /Users/ravindragupta/.rbenv/shims/pod SDKs: iOS SDK: Platforms: - DriverKit 22.4 - iOS 16.4 - macOS 13.3 - tvOS 16.4 - watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.10121639 Xcode: version: 14.3.1/14E300c path: /usr/bin/xcodebuild Languages: Java: version: 11.0.19 path: /usr/bin/javac Ruby: version: 3.0.4 path: /Users/ravindragupta/.rbenv/shims/ruby npmPackages: "@react-native-community/cli": installed: 11.3.5 wanted: ^11.3.4 react: installed: 18.2.0 wanted: ^18.2.0 react-native: installed: 0.72.1 wanted: 0.72.1 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: false newArchEnabled: true iOS: hermesEnabled: false newArchEnabled: true
Steps to reproduce
Run Jenkins build for React Native Application with 0.72.1.
Snack, code example, screenshot, or link to a repository
Steps to reproduce
Run Release build for React Native Application with 0.72.1
Steps to reproduce Run Release build for React Native Application with 0.72.1
This is not correct, as I see in your build log that you have react-native-webview
and other libraries.
Specifically this kind of error:
C/C++: CMake Error at /Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:6 (add_subdirectory):
C/C++: add_subdirectory given source
C/C++: "/Users/****/JenkinsAgentUsevol/workspace/mobilev2_ILX-44410-jenkins-build/native/node_modules/@react-native-community/datetimepicker/android/build/generated/source/codegen/jni/"
C/C++: which is not an existing directory.
are happening when libraries are failing to invoke codegen.
I would need a reproducer to help you further as I don't know what's happening with your setup.
:warning: | Missing Reproducible Example |
---|---|
:information_source: | It looks like your issue is missing a reproducible example. Please provide either:
|
@cortinico I am able to run npx react-native run-android --mode release
without any error but somehow when I run ./gradlew assembleRelease
or /bin/bash gradlew assembleRelease
I get all these issue, can you please check or point out where the issue can be. I am really exhausted, invested 3 days but with no luck, I would really thankful to you.
adding gradle files for your reference:
android/app/build.gradle
def keystorePropertiesFile = rootProject.file("keystore.properties");
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
apply plugin: "com.android.application"
apply plugin: 'com.facebook.react'
apply plugin: 'com.google.gms.google-services'
import com.android.build.OutputFile
/**
* This is the configuration block to customize your React Native Android app.
* By default you don't need to apply any configuration, just uncomment the lines you need.
*/
react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
// root = file("../")
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
// reactNativeDir = file("../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
// codegenDir = file("../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")
/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
// debuggableVariants = ["liteDebug", "prodDebug"]
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
//
// The path to the CLI configuration file. Default is empty.
// bundleConfig = file(../rn-cli.config.js)
//
// The name of the generated asset file containing your JS bundle
// bundleAssetName = "index.android.bundle"
//
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
// entryFile = file("../index.js")
//
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
// extraPackagerArgs = []
/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
}
/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc-intl:+'
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
namespace "com.intelex.intelexmobile"
defaultConfig {
missingDimensionStrategy 'react-native-camera', 'general'
applicationId "com.intelex.intelexmobile"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 19100
versionName "2.134.276"
multiDexEnabled true
}
flavorDimensions "version"
productFlavors {
normal {
getIsDefault().set(true)
}
}
lintOptions {
// this disables the lint check, need to take a look at error logs at
// /app/build/reports/lint-results-release-fatal.html or /app/build/reports/lint-results-release-fatal.xml
checkReleaseBuilds false
}
dexOptions {
javaMaxHeapSize "4g"
}
splits {
abi {
reset()
enable true
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
config {
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
}
}
buildTypes {
debug {
signingConfig signingConfigs.config
getIsDefault().set(true)
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.config
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// https://developer.android.com/studio/build/configure-apk-splits.html
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 =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
// The version of react-native is set by the React Native Gradle Plugi
implementation("com.facebook.react:react-android")
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
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}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
// See: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl
kotlinVersion = "1.7.0"
// Only using Android Support libraries, this is required by in-app browser
supportLibVersion = "33.0.0"
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
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:1.7.0"
classpath 'com.google.gms:google-services:4.3.15'
}
}
@cortinico What works for me is, using ./gradlew bundleRelease
before ./gradlew assembleRelease
. But this was not the case before (without using new architecture), as we were able to create apk with only ./gradlew assembleRelease
command. Please explain.
I am able to run
npx react-native run-android --mode release
without any error
Are you then able to run npx react-native build-android --mode release
That will create the APK for you.
Documentation is here:
https://github.com/react-native-community/cli/blob/main/packages/cli-platform-android/README.md#build-android
@cortinico I tried the command npx react-native build-android --mode release
but this does not generate apk instead an .aab file (app-normal-release.aab), we need release apk file for internal deployment.
Command npx react-native run-android --mode release
also generates apk but it little heavier (65.x mb) than creating using ./gradlew bundleRelease && ./gradlew assembleRelease
(62.x mb)
Also it tries to run on connected device, is there any command just to create the apk.
Could you open this same issue here: https://github.com/react-native-community/cli/issues
We're experiencing the exactly same issue. @ravindraguptacapgemini , were you able to have it solved?
Could you open this same issue here: react-native-community/cli/issues
Closing as the corresponding issue on the CLI has also been closed https://github.com/react-native-community/cli/issues/2010
Let's open a new issue if the problem persists