margelo / react-native-quick-crypto

⚡️ A fast implementation of Node's `crypto` module written in C/C++ JSI
Other
697 stars 83 forks source link

FAILURE: Build failed with an exception - RN 0.73.2 #226

Closed altaga closed 4 months ago

altaga commented 8 months ago

Error when Build in RN 0.73.2

image

When I am developing the module works perfectly, but when I build it it fails.

Package json

{
  "name": "lightsaver",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android --terminal powershell",
    "build": "cd android && gradlew app:assembleRelease && cd ..",
    "clean": "cd android && gradlew clean && cd ..",
    "depcheck": "depcheck",
    "updatefonts": "npx react-native-asset",
    "deploy": "cd android && gradlew app:assembleRelease && adb install -r app/build/outputs/apk/release/app-release.apk",
    "updateversion": "npx react-native-version --never-amend",
    "ios": "react-native run-ios",
    "installapp": "adb install -r android/app/build/outputs/apk/release/app-release.apk",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest",
    "rec": "adb reverse tcp:8081 tcp:8081",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@babel/plugin-proposal-class-properties": "^7.18.6",
    "@babel/plugin-transform-flow-strip-types": "^7.23.3",
    "@craftzdog/react-native-buffer": "^6.0.5",
    "@ethersproject/shims": "^5.7.0",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-native-clipboard/clipboard": "^1.13.2",
    "@react-native-community/slider": "^4.5.0",
    "@react-native-picker/picker": "^2.6.1",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/native-stack": "^6.9.17",
    "@walletconnect/universal-provider": "^2.11.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "decimal.js": "^10.4.3",
    "depcheck": "^1.4.7",
    "ethers": "5.7.0",
    "fast-text-encoding": "^1.0.6",
    "metro-react-native-babel-preset": "^0.77.0",
    "node-emv": "^1.0.22",
    "node-libs-react-native": "^1.2.1",
    "patch-package": "^8.0.0",
    "postinstall-postinstall": "^2.1.0",
    "react": "^18.2.0",
    "react-autobind": "^1.0.6",
    "react-native": "^0.73.2",
    "react-native-background-actions": "^3.0.1",
    "react-native-biometrics": "^3.0.1",
    "react-native-camera-kit": "^13.0.0",
    "react-native-dotenv": "^3.4.9",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-encrypted-storage": "^4.0.3",
    "react-native-form-component": "^2.6.14",
    "react-native-get-random-values": "^1.10.0",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-nfc-manager": "^3.14.12",
    "react-native-picker-select": "^9.0.1",
    "react-native-print": "^0.11.0",
    "react-native-qrcode-styled": "0.2.1",
    "react-native-qrcode-svg": "^6.2.0",
    "react-native-quick-crypto": "^0.6.1",
    "react-native-safe-area-context": "^4.8.2",
    "react-native-screens": "^3.29.0",
    "react-native-svg": "^14.1.0",
    "react-native-url-polyfill": "^2.0.0",
    "react-native-vector-icons": "^10.0.3",
    "react-native-version": "^4.0.0",
    "react-native-virtual-keyboard": "1.2.2",
    "stream-browserify": "^3.0.0",
    "text-encoding-polyfill": "^0.6.7"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/plugin-proposal-private-methods": "^7.18.6",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/babel-preset": "0.73.19",
    "@react-native/eslint-config": "0.73.2",
    "@react-native/metro-config": "0.73.3",
    "@react-native/typescript-config": "0.73.1",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.2.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

android.build.gradle

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 23
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "25.1.8937393"
        kotlinVersion = "1.8.0"
    }
    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")
    }
}

apply plugin: "com.facebook.react.rootproject"

android.app.build.gradle

apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply plugin: "kotlin-android"
apply plugin: "kotlin-parcelize" // apply plugin: "kotlin-android-extensions"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

react {

}

/**
 * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
 */
def enableProguardInReleaseBuilds = false
def jscFlavor = 'org.webkit:android-jsc:+'

android {
    ndkVersion rootProject.ext.ndkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    compileSdk rootProject.ext.compileSdkVersion

    namespace "com.altaga.lightsaver"
    defaultConfig {
        applicationId "com.altaga.lightsaver"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 2
        versionName "0.0.1"
        resConfigs "en"
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        release {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
            debuggable true
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            shrinkResources true
            zipAlignEnabled true
            minifyEnabled true
            debuggable false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
        }
    }
    packagingOptions {
        pickFirst 'lib/x86/libcrypto.so'
        pickFirst 'lib/x86_64/libcrypto.so'
        pickFirst 'lib/armeabi-v7a/libcrypto.so'
        pickFirst 'lib/arm64-v8a/libcrypto.so'
    }
}

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")
    implementation("com.facebook.react:flipper-integration")

    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)
boorad commented 4 months ago

Can you upgrade to one of the latest 0.7.0-rc.x release candidates, and also upgrade react-native-quick-base64 to 2.1.2 and see if this issue persists?