Closed chengjunzhang1219 closed 1 year 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
: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. |
@cortinico Thanks I will share my gradle files
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"
}
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.
@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?
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).
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.
This issue was closed because it has been stalled for 7 days with no activity.
Description
While was upgrading the react-native version to 0.69.0, I am getting this errors.
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