最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - React Native: App crashes on start due to SoLoader issue - Stack Overflow

programmeradmin2浏览0评论

I'm having issues with my app on Android (iOS is running fine). Every time I do the build, when I open the application it closes before starting. I have tried many solutions that I have been looking for in Github and here, and I have not been able to solve it yet.

The installation is clean, and I have checked that I am not missing anything in the build.gradle file.

Error

02-13 11:56:31.627  7613  7613 D SoLoader: adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86 flags = 0]
    02-13 11:56:31.628  7613  7613 D SoLoader: adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/data/com.bookinglayer.businessApp/lib-main flags = 1]
    02-13 11:56:31.632  7613  7613 D SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86 flags = 0]
    02-13 11:56:31.632  7613  7613 D SoLoader: Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/data/com.bookinglayer.businessApp/lib-main flags = 1]
    02-13 11:56:31.632  7613  7613 V fb-UnpackingSoSource: locked dso store /data/user/0/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.633  7613  7613 I fb-UnpackingSoSource: dso store is up-to-date: /data/user/0/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.633  7613  7613 V fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.718  7613  7613 D SoLoader: libjscexecutor.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.718  7613  7613 D SoLoader: libjscexecutor.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:31.916  7613  7634 D SoLoader: libreactnativejni.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.917  7613  7634 D SoLoader: libreactnativejni.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:32.019  7613  7634 D SoLoader: libfb.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:32.019  7613  7634 D SoLoader: libfb.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:32.045  1762  1762 E Layer   : [Surface(name=AppWindowToken{79aab0 token=Token{5578df3 ActivityRecord{5ebb862 u0 com.bookinglayer.businessApp/.MainActivity t123}}})/@0x9758047 - animation-leash#0] No local sync point found
    02-13 11:56:32.045  1762  1762 E Layer   : [Surface(name=AppWindowToken{79aab0 token=Token{5578df3 ActivityRecord{5ebb862 u0 com.bookinglayer.businessApp/.MainActivity t123}}})/@0x9758047 - animation-leash#0] No local sync point found
    02-13 11:56:32.073  7613  7634 D SoLoader: libfb.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:32.073  7613  7634 D SoLoader: libfb.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:32.073  7613  7634 I yer.businessAp: Thread[15,tid=7634,Native,Thread*=0xd3981a00,peer=0x18f5bb70,"create_react_context"] recursive attempt to load library "/data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86/libfb.so"
    02-13 11:56:32.460  2048  2078 I ActivityTaskManager: Displayed com.bookinglayer.businessApp/.MainActivity: +990ms
    02-13 11:56:32.639  7613  7637 D SoLoader: libyoga.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:32.639  7613  7637 D SoLoader: libyoga.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:33.282  7613  7637 E AndroidRuntime: Process: com.bookinglayer.businessApp, PID: 7613
    02-13 11:56:33.283  2048  4712 W ActivityTaskManager:   Force finishing activity com.bookinglayer.businessApp/.MainActivity
    02-13 11:56:33.614  2048  4712 I ActivityManager: Process com.bookinglayer.businessApp (pid 7613) has died: cch CRE 

build.gradle

apply plugin: "com.android.application"

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
 *   entryFile: "index.android.js",
 *
 *   // 
 *   bundleCommand: "ram-bundle",
 *
 *   // 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 
 *   // 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 = [
    entryFile: "index.js",
    enableHermes: false,  // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

/**
 * 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

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * 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:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored 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", false);

android {
    compileSdkVersion rootProject.extpileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.bookinglayer.businessApp"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 6
        versionName "2.0.0"
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // 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:
            // .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 {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"
    implementation "androidx.appcompat:appcompat:1.0.0"
    implementation 'org.webkit:android-jsc:+'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// 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 configurationspile
    into 'libs'
}



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

package.json

{
  "name": "business-app",
  "version": "2.0.0",
  "private": true,
  "scripts": {
    "android:clean": "cd ./android && ./gradlew clean && cd ../",
    "android:staging": "ENVFILE=.env.staging react-native run-android --variant=release",
    "android:dev": "ENVFILE=.env.dev react-native run-android --variant=release",
    "android:debug": "adb logcat | grep com.bookinglayer.businessApp ",
    "android:beta:dev": "ENVFILE=.env.dev bundle exec fastlane android beta",
    "android:beta:staging": "ENVFILE=.env.staging bundle exec fastlane android beta",
    "android:release": "bundle exec fastlane android release",
    "ios:staging": "ENVFILE=.env.staging react-native run-ios",
    "ios:dev": "ENVFILE=.env.dev react-native run-ios",
    "ios:beta:dev": "ENVFILE=.env.dev bundle exec fastlane ios beta",
    "ios:beta:staging": "ENVFILE=.env.staging bundle exec fastlane ios beta",
    "ios:release": "bundle exec fastlane ios release",
    "e2e:build": "ENVFILE=.env.dev detox build",
    "e2e:test": "ENVFILE=.env.dev detox test",
    "start": "react-native start",
    "test": "jest ./lib",
    "lint": "eslint ./app ./lib",
    "setup": "make install",
    "postinstall": "npx jetify; react-native-port-patcher --new-port 8088",
    "clean": "rm -rf ios/Podfile.lock && rm -rf ios/Pods/ && rm -rf /node-modules/ && rm -rf yarn.lock && rm -rf package-lock.json",
    "clear-cache": "watchman watch-del-all && rm -rf node_modules/ && yarn install && react-native start --reset-cache",
    "release": "semantic-release",
    "prettier": "prettier --check \"**/*.js\"",
    "link-assets": "npx react-native-asset",
    "rename-fonts": "node ./renameFonts.js"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.3",
    "moment": "^2.24.0",
    "native-base": ".git#master",
    "prop-types": "^15.7.2",
    "react": "16.9.0",
    "react-intl": "^3.4.0",
    "react-native": "0.61.5",
    "react-native-calendars": "^1.260.0",
    "react-native-config": "^0.12.0",
    "react-native-easy-grid": "^0.2.2",
    "react-native-flash-message": "^0.1.15",
    "react-native-gesture-handler": "^1.5.0",
    "react-native-modal": "^11.5.2",
    "react-native-pell-rich-editor": "^1.0.4",
    "react-native-phone-input": "^0.2.4",
    "react-native-reanimated": "^1.4.0",
    "react-native-render-html": "^4.2.0",
    "react-native-render-html-table-bridge": "^0.5.2",
    "react-native-safe-area-context": "^0.6.2",
    "react-native-safe-area-view": "^1.0.0",
    "react-native-screens": "^2.0.0-alpha.8",
    "react-native-svg": "^9.13.3",
    "react-native-svg-flagkit": "^0.9.5",
    "react-native-webview": "^8.0.3",
    "react-navigation": "^4.0.10",
    "react-navigation-drawer": "^2.3.3",
    "react-navigation-hooks": "^1.1.0",
    "react-navigation-stack": "^1.10.3",
    "react-redux": "^7.1.1",
    "redux": "^4.0.4",
    "redux-devtools-extension": "^2.13.8",
    "redux-form": "^8.2.6",
    "redux-saga": "^1.1.3",
    "styled-components": "^4.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.6.4",
    "@babel/runtime": "^7.6.3",
    "@react-native-community/eslint-config": "^0.0.5",
    "@semantic-release/git": "^7.0.18",
    "babel-jest": "^24.9.0",
    "babel-plugin-module-resolver": "^3.2.0",
    "detox": "^14.6.0",
    "eslint": "^6.6.0",
    "eslint-config-airbnb": "^18.0.1",
    "eslint-config-prettier": "^6.5.0",
    "eslint-loader": "^3.0.2",
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-json": "^2.0.1",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-prettier": "^3.1.1",
    "eslint-plugin-react": "^7.16.0",
    "fs": "^0.0.1-security",
    "jest": "^24.9.0",
    "jest-styled-components": "^6.3.4",
    "jetifier": "^1.6.4",
    "metro-react-native-babel-preset": "^0.57.0",
    "opentype.js": "^1.1.0",
    "prettier": "^1.18.2",
    "react-native-port-patcher": "^1.0.3",
    "react-native-version": "^3.2.0",
    "react-test-renderer": "^16.11.0",
    "semantic-release": "^15.13.30"
  },
  "jest": {
    "preset": "react-native",
    "transformIgnorePatterns": [
      "node_modules/(?!react-native|native-base-shoutem-theme|react-navigation|@shoutem/animation|@shoutem/ui|tcomb-form-native)"
    ],
    "moduleNameMapper": {
      "styled-components": "<rootDir>/node_modules/styled-components/native/dist/styled-components.native.cjs.js"
    }
  },
  "detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/BookingLayer/Build/Products/Debug-iphonesimulator/BookingLayer.app",
        "build": "xcodebuild -workspace ios/BookingLayer.xcworkspace -scheme BookingLayer -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build/BookingLayer",
        "type": "ios.simulator",
        "device": {
          "type": "iPhone 11 Pro"
        }
      }
    },
    "test-runner": "jest"
  }
}

Any idea what can I do? Thank you so much in advance!

I'm having issues with my app on Android (iOS is running fine). Every time I do the build, when I open the application it closes before starting. I have tried many solutions that I have been looking for in Github and here, and I have not been able to solve it yet.

The installation is clean, and I have checked that I am not missing anything in the build.gradle file.

Error

02-13 11:56:31.627  7613  7613 D SoLoader: adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86 flags = 0]
    02-13 11:56:31.628  7613  7613 D SoLoader: adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/data/com.bookinglayer.businessApp/lib-main flags = 1]
    02-13 11:56:31.632  7613  7613 D SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86 flags = 0]
    02-13 11:56:31.632  7613  7613 D SoLoader: Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/data/com.bookinglayer.businessApp/lib-main flags = 1]
    02-13 11:56:31.632  7613  7613 V fb-UnpackingSoSource: locked dso store /data/user/0/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.633  7613  7613 I fb-UnpackingSoSource: dso store is up-to-date: /data/user/0/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.633  7613  7613 V fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.718  7613  7613 D SoLoader: libjscexecutor.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.718  7613  7613 D SoLoader: libjscexecutor.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:31.916  7613  7634 D SoLoader: libreactnativejni.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:31.917  7613  7634 D SoLoader: libreactnativejni.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:32.019  7613  7634 D SoLoader: libfb.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:32.019  7613  7634 D SoLoader: libfb.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:32.045  1762  1762 E Layer   : [Surface(name=AppWindowToken{79aab0 token=Token{5578df3 ActivityRecord{5ebb862 u0 com.bookinglayer.businessApp/.MainActivity t123}}})/@0x9758047 - animation-leash#0] No local sync point found
    02-13 11:56:32.045  1762  1762 E Layer   : [Surface(name=AppWindowToken{79aab0 token=Token{5578df3 ActivityRecord{5ebb862 u0 com.bookinglayer.businessApp/.MainActivity t123}}})/@0x9758047 - animation-leash#0] No local sync point found
    02-13 11:56:32.073  7613  7634 D SoLoader: libfb.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:32.073  7613  7634 D SoLoader: libfb.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:32.073  7613  7634 I yer.businessAp: Thread[15,tid=7634,Native,Thread*=0xd3981a00,peer=0x18f5bb70,"create_react_context"] recursive attempt to load library "/data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86/libfb.so"
    02-13 11:56:32.460  2048  2078 I ActivityTaskManager: Displayed com.bookinglayer.businessApp/.MainActivity: +990ms
    02-13 11:56:32.639  7613  7637 D SoLoader: libyoga.so not found on /data/data/com.bookinglayer.businessApp/lib-main
    02-13 11:56:32.639  7613  7637 D SoLoader: libyoga.so found on /data/app/com.bookinglayer.businessApp-mIjzUZ2SWw_f_dlNjdPM_Q==/lib/x86
    02-13 11:56:33.282  7613  7637 E AndroidRuntime: Process: com.bookinglayer.businessApp, PID: 7613
    02-13 11:56:33.283  2048  4712 W ActivityTaskManager:   Force finishing activity com.bookinglayer.businessApp/.MainActivity
    02-13 11:56:33.614  2048  4712 I ActivityManager: Process com.bookinglayer.businessApp (pid 7613) has died: cch CRE 

build.gradle

apply plugin: "com.android.application"

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
 *   entryFile: "index.android.js",
 *
 *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
 *   bundleCommand: "ram-bundle",
 *
 *   // 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 = [
    entryFile: "index.js",
    enableHermes: false,  // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

/**
 * 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

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * 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:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored 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", false);

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.bookinglayer.businessApp"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 6
        versionName "2.0.0"
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // 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:
            // 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 {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"
    implementation "androidx.appcompat:appcompat:1.0.0"
    implementation 'org.webkit:android-jsc:+'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// 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.compile
    into 'libs'
}



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

package.json

{
  "name": "business-app",
  "version": "2.0.0",
  "private": true,
  "scripts": {
    "android:clean": "cd ./android && ./gradlew clean && cd ../",
    "android:staging": "ENVFILE=.env.staging react-native run-android --variant=release",
    "android:dev": "ENVFILE=.env.dev react-native run-android --variant=release",
    "android:debug": "adb logcat | grep com.bookinglayer.businessApp ",
    "android:beta:dev": "ENVFILE=.env.dev bundle exec fastlane android beta",
    "android:beta:staging": "ENVFILE=.env.staging bundle exec fastlane android beta",
    "android:release": "bundle exec fastlane android release",
    "ios:staging": "ENVFILE=.env.staging react-native run-ios",
    "ios:dev": "ENVFILE=.env.dev react-native run-ios",
    "ios:beta:dev": "ENVFILE=.env.dev bundle exec fastlane ios beta",
    "ios:beta:staging": "ENVFILE=.env.staging bundle exec fastlane ios beta",
    "ios:release": "bundle exec fastlane ios release",
    "e2e:build": "ENVFILE=.env.dev detox build",
    "e2e:test": "ENVFILE=.env.dev detox test",
    "start": "react-native start",
    "test": "jest ./lib",
    "lint": "eslint ./app ./lib",
    "setup": "make install",
    "postinstall": "npx jetify; react-native-port-patcher --new-port 8088",
    "clean": "rm -rf ios/Podfile.lock && rm -rf ios/Pods/ && rm -rf /node-modules/ && rm -rf yarn.lock && rm -rf package-lock.json",
    "clear-cache": "watchman watch-del-all && rm -rf node_modules/ && yarn install && react-native start --reset-cache",
    "release": "semantic-release",
    "prettier": "prettier --check \"**/*.js\"",
    "link-assets": "npx react-native-asset",
    "rename-fonts": "node ./renameFonts.js"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.3",
    "moment": "^2.24.0",
    "native-base": "https://github.com/GeekyAnts/NativeBase.git#master",
    "prop-types": "^15.7.2",
    "react": "16.9.0",
    "react-intl": "^3.4.0",
    "react-native": "0.61.5",
    "react-native-calendars": "^1.260.0",
    "react-native-config": "^0.12.0",
    "react-native-easy-grid": "^0.2.2",
    "react-native-flash-message": "^0.1.15",
    "react-native-gesture-handler": "^1.5.0",
    "react-native-modal": "^11.5.2",
    "react-native-pell-rich-editor": "^1.0.4",
    "react-native-phone-input": "^0.2.4",
    "react-native-reanimated": "^1.4.0",
    "react-native-render-html": "^4.2.0",
    "react-native-render-html-table-bridge": "^0.5.2",
    "react-native-safe-area-context": "^0.6.2",
    "react-native-safe-area-view": "^1.0.0",
    "react-native-screens": "^2.0.0-alpha.8",
    "react-native-svg": "^9.13.3",
    "react-native-svg-flagkit": "^0.9.5",
    "react-native-webview": "^8.0.3",
    "react-navigation": "^4.0.10",
    "react-navigation-drawer": "^2.3.3",
    "react-navigation-hooks": "^1.1.0",
    "react-navigation-stack": "^1.10.3",
    "react-redux": "^7.1.1",
    "redux": "^4.0.4",
    "redux-devtools-extension": "^2.13.8",
    "redux-form": "^8.2.6",
    "redux-saga": "^1.1.3",
    "styled-components": "^4.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.6.4",
    "@babel/runtime": "^7.6.3",
    "@react-native-community/eslint-config": "^0.0.5",
    "@semantic-release/git": "^7.0.18",
    "babel-jest": "^24.9.0",
    "babel-plugin-module-resolver": "^3.2.0",
    "detox": "^14.6.0",
    "eslint": "^6.6.0",
    "eslint-config-airbnb": "^18.0.1",
    "eslint-config-prettier": "^6.5.0",
    "eslint-loader": "^3.0.2",
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-json": "^2.0.1",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-prettier": "^3.1.1",
    "eslint-plugin-react": "^7.16.0",
    "fs": "^0.0.1-security",
    "jest": "^24.9.0",
    "jest-styled-components": "^6.3.4",
    "jetifier": "^1.6.4",
    "metro-react-native-babel-preset": "^0.57.0",
    "opentype.js": "^1.1.0",
    "prettier": "^1.18.2",
    "react-native-port-patcher": "^1.0.3",
    "react-native-version": "^3.2.0",
    "react-test-renderer": "^16.11.0",
    "semantic-release": "^15.13.30"
  },
  "jest": {
    "preset": "react-native",
    "transformIgnorePatterns": [
      "node_modules/(?!react-native|native-base-shoutem-theme|react-navigation|@shoutem/animation|@shoutem/ui|tcomb-form-native)"
    ],
    "moduleNameMapper": {
      "styled-components": "<rootDir>/node_modules/styled-components/native/dist/styled-components.native.cjs.js"
    }
  },
  "detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/BookingLayer/Build/Products/Debug-iphonesimulator/BookingLayer.app",
        "build": "xcodebuild -workspace ios/BookingLayer.xcworkspace -scheme BookingLayer -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build/BookingLayer",
        "type": "ios.simulator",
        "device": {
          "type": "iPhone 11 Pro"
        }
      }
    },
    "test-runner": "jest"
  }
}

Any idea what can I do? Thank you so much in advance!

Share Improve this question asked Feb 13, 2020 at 11:07 albertogallegoalbertogallego 1211 gold badge1 silver badge5 bronze badges 1
  • Maybe you can look into this: github.com/facebook/SoLoader – vicky keshri Commented Aug 25, 2020 at 7:54
Add a comment  | 

4 Answers 4

Reset to default 6

Add configurations.all section to android/build.gradle file. This solved the issue for me. don't forget to run ./gradlew clean inside android folder.

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        // add below code - start
        configurations.all {
            resolutionStrategy {
                // use 0.9.0 to fix crash on Android 11
                force "com.facebook.soloader:soloader:0.9.0+"
            }
        }
        // code - end
        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

Add the following to your android/app/build.gradle file:

dependencies {
   ....
   implementation 'com.facebook.soloader:soloader:0.9.0+'
   ....
}

I resolved the issue by updating to the most recent version of soloader, which, in my case, is 0.10.4. To do this, replace the previous dependency

com.facebook.soloader:soloader:0.9.0+ 

with

com.facebook.soloader:soloader:0.10.4

To identify the latest version of soloader compatible with your project, navigate to the following file path:

/node_modules/react-native/ReactAndroid/gradle.properties. 

In that file, you will find the compatible version of soloader specified under the name SO_LOADER_VERSION

For latest fix, perform the below steps:

  1. Look for soloader in the project and in build directory.

  2. If you find all searched code related to the package (for mine it was all with facebook).

  3. Force dependencies by mentioning it in your app.gradle file.

    dependencies { implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.facebook.soloader:soloader:0.10.4+' }

I've just tested it so I can't confirm it works yet, but it seems like Google support has a solution which is to use versions 0.10.4+.

It should work if you use that version in both the dependencies requirements and resolution strategy like proposed in this other solution.

发布评论

评论列表(0)

  1. 暂无评论