Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution failed for duplicate resources #934

Closed
NikhilMasurkar opened this issue Feb 28, 2023 · 15 comments
Closed

Execution failed for duplicate resources #934

NikhilMasurkar opened this issue Feb 28, 2023 · 15 comments

Comments

@NikhilMasurkar
Copy link

NikhilMasurkar commented Feb 28, 2023

New Version

0.71.3

Old Version

0.64.2

Build Target(s)

Could not resolve ':app:createBundleDevDebugJsAndAssets'. and java.lang.StackOverflowError (no error message) this error

Output of react-native info

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:createBundleDevDebugJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1


2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

Issue and Reproduction Steps

android/app/build.gradle

apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: 'com.google.gms.google-services'
googleServices {
    disableVersionCheck = true
}
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: "com.google.firebase.firebase-perf"

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",
 *
 *   // https://reactnative.dev/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: true,  // clean and rebuild if changing
]

project.ext.envConfigFiles = [
    dev: "env/.env.dev",
    prod: "env/.env.prod",
]

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.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

/**
 * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
 */
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);

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    namespace "com.indigolearn.fin1"
    defaultConfig {
        applicationId "com.indigolearn.fin1"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis())
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        versionCode 55
        versionName "2.1.2"
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include (*reactNativeArchitectures())
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        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
            } else {
                storeFile file('debug.keystore')
                storePassword 'android'
                keyAlias 'androiddebugkey'
                keyPassword 'android'
            }
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    flavorDimensions "default"
    productFlavors {
        dev {
            minSdkVersion rootProject.ext.minSdkVersion
            applicationId 'com.indigolearn.fin1.dev'
            targetSdkVersion rootProject.ext.targetSdkVersion
            signingConfig signingConfigs.debug
            resValue "string", "build_config_package", "com.indigolearn.fin1"
        }
        prod {
            minSdkVersion rootProject.ext.minSdkVersion
            applicationId 'com.indigolearn.fin1'
            targetSdkVersion rootProject.ext.targetSdkVersion
            signingConfig signingConfigs.release
            resValue "string", "build_config_package", "com.indigolearn.fin1"
        }
    }
    // 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
            // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
            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)
            }

        }
    }
}

dependencies {
     implementation("com.facebook.react:react-android")
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        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
    }
    
    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
    implementation project(':react-native-razorpay')
}

// 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'
}

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

android/build.gradle..............................................................

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

buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
         compileSdkVersion = 33
        targetSdkVersion = 33

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
        googlePlayServicesAuthVersion = "16.0.1"
        firebaseIidVersion = "18.0.0"
        kotlin_version = '1.6.10' // <- add this line

    }
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
         classpath("com.android.tools.build:gradle:7.3.1")
         classpath("com.facebook.react:react-native-gradle-plugin")
         classpath 'com.google.gms:google-services:4.3.14'
         classpath'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
         classpath 'com.google.firebase:perf-plugin:1.4.2'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10" // <- add this line

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {

    def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

    configurations.all {
        resolutionStrategy {
            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
             }
        }
        
    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")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
        maven { url 'https://maven.google.com' }
        maven {
              url "https://github.com/VdoCipher/maven-repo/raw/master/repo"
        }
    }
}
@cortinico
Copy link

Can you also please share the full console log?

@github-actions
Copy link

⚠️ Missing Environment Information
ℹ️ Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console.

@NikhilMasurkar
Copy link
Author

Can you also please share the full console log?

Okay I will share

@ketimaBU

This comment was marked as off-topic.

@cortinico
Copy link

I am facing the same issue when upgraded from 0.66.4 to 0.73.1

Please open a separate issue.

@NikhilMasurkar
Copy link
Author

NikhilMasurkar commented Feb 28, 2023

Error: resolveDependencies: Found duplicate dependency key 'undefined' in C:\Project_Repo\App_Frontend\IndigoLearn\index.js
    at Graph._resolveDependencies (C:\Project_Repo\App_Frontend\IndigoLearn\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\Graph.js:449:15)
    at Graph._processModule (C:\Project_Repo\App_Frontend\IndigoLearn\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\Graph.js:218:38)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Graph._traverseDependenciesForSingleFile (C:\Project_Repo\App_Frontend\IndigoLearn\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\Graph.js:207:5)
    at async Promise.all (index 0)
    at async Graph.initialTraverseDependencies (C:\Project_Repo\App_Frontend\IndigoLearn\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\Graph.js:191:5)
    at async DeltaCalculator._getChangedDependencies (C:\Project_Repo\App_Frontend\IndigoLearn\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:196:25)
    at async DeltaCalculator.getDelta (C:\Project_Repo\App_Frontend\IndigoLearn\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:90:16)
    at async DeltaBundler.buildGraph (C:\Project_Repo\App_Frontend\IndigoLearn\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\DeltaBundler.js:54:5)
    at async IncrementalBundler.buildGraphForEntries (C:\Project_Repo\App_Frontend\IndigoLearn\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\IncrementalBundler.js:64:19)

> Task :app:createBundleDevDebugJsAndAssets FAILED

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.5.1/userguide/command_line_interface.html#sec:command_line_warnings
97 actionable tasks: 4 executed, 93 up-to-date
error resolveDependencies: Found duplicate dependency key 'undefined' in C:\Project_Repo\App_Frontend\IndigoLearn\index.js

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:createBundleDevDebugJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* 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

BUILD FAILED in 1m 10s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDevDebug -PreactNativeDevServerPort=8081
error resolveDependencies: Found duplicate dependency key 'undefined' in C:\Project_Repo\App_Frontend\IndigoLearn\index.js    

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:createBundleDevDebugJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

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

@NikhilMasurkar
Copy link
Author

I am facing the same issue when upgraded from 0.66.4 to 0.73.1

Please open a separate issue.

please check it once

@cortinico cortinico transferred this issue from facebook/react-native Mar 1, 2023
@cortinico
Copy link

Passing over to the Metro team as the build failed during bundling.

@robhogan
Copy link
Contributor

robhogan commented Mar 1, 2023

This looks like #857 (comment)

TL;DR: - you likely have multiple versions of Metro in your node_modules.

Make sure you have no explicit Metro dependencies in your package.json, delete your yarn.lock and node_modules and re-run Yarn.

@NikhilMasurkar
Copy link
Author

okay so in dev dependency I have a package called "metro-react-native-babel-preset" but from the package, metro was missing, so I add the latest version of the metro now and it works,
but
I got a new error same while the time of building the app

Task :app:mergeDevDebugAssets FAILED

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.5.1/userguide/command_line_interface.html#sec:command_line_warnings
181 actionable tasks: 168 executed, 13 up-to-date
ERROR:[fonts/AntDesign.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\AntDesign.ttf [fonts/AntDesign.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\AntDesign.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/Entypo.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Entypo.ttf [fonts/Entypo.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Entypo.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/EvilIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\EvilIcons.ttf [fonts/EvilIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\EvilIcons.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/Feather.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Feather.ttf [fonts/Feather.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Feather.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/FontAwesome.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\FontAwesome.ttf [fonts/FontAwesome.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\FontAwesome.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/FontAwesome5_Brands.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\FontAwesome5_Brands.ttf [fonts/FontAwesome5_Brands.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\FontAwesome5_Brands.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/FontAwesome5_Regular.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\FontAwesome5_Regular.ttf [fonts/FontAwesome5_Regular.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\FontAwesome5_Regular.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/FontAwesome5_Solid.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\FontAwesome5_Solid.ttf [fonts/FontAwesome5_Solid.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\FontAwesome5_Solid.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/Fontisto.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Fontisto.ttf [fonts/Fontisto.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Fontisto.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/Foundation.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Foundation.ttf [fonts/Foundation.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Foundation.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/Ionicons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Ionicons.ttf [fonts/Ionicons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Ionicons.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/MaterialCommunityIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\MaterialCommunityIcons.ttf [fonts/MaterialCommunityIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\MaterialCommunityIcons.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/MaterialIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\MaterialIcons.ttf [fonts/MaterialIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\MaterialIcons.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/Octicons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Octicons.ttf [fonts/Octicons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Octicons.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/SimpleLineIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\SimpleLineIcons.ttf [fonts/SimpleLineIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\SimpleLineIcons.ttf: Resource and asset merger: Duplicate resources
ERROR:[fonts/Zocial.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Zocial.ttf [fonts/Zocial.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Zocial.ttf: Resource and asset merger: Duplicate resources

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mergeDevDebugAssets'.

[fonts/AntDesign.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\AntDesign.ttf [fonts/AntDesign.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\AntDesign.ttf: Error: Duplicate resources
[fonts/Entypo.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Entypo.ttf [fonts/Entypo.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Entypo.ttf: Error: Duplicate resources
[fonts/EvilIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\EvilIcons.ttf [fonts/EvilIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\EvilIcons.ttf: Error: Duplicate resources
[fonts/Feather.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Feather.ttf [fonts/Feather.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Feather.ttf: Error: Duplicate resources
[fonts/FontAwesome.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\FontAwesome.ttf [fonts/FontAwesome.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\FontAwesome.ttf: Error: Duplicate resources
[fonts/FontAwesome5_Brands.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\FontAwesome5_Brands.ttf [fonts/FontAwesome5_Brands.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\FontAwesome5_Brands.ttf: Error: Duplicate resources
[fonts/FontAwesome5_Regular.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\FontAwesome5_Regular.ttf [fonts/FontAwesome5_Regular.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\FontAwesome5_Regular.ttf: Error: Duplicate resources
[fonts/FontAwesome5_Solid.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\FontAwesome5_Solid.ttf [fonts/FontAwesome5_Solid.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\FontAwesome5_Solid.ttf: Error: Duplicate resources
[fonts/Fontisto.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Fontisto.tt[fonts/Fontisto.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Fontisto.ttf: Error: Duplicate resources
[fonts/Foundation.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Foundation.ttf [fonts/Foundation.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Foundation.ttf: Error: Duplicate resources
[fonts/Ionicons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Ionicons.tt[fonts/Ionicons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Ionicons.ttf: Error: Duplicate resources
[fonts/MaterialCommunityIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\MaterialCommunityIcons.ttf [fonts/MaterialCommunityIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\MaterialCommunityIcons.ttf: Error: Duplicate resources
[fonts/MaterialIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\MaterialIcons.ttf [fonts/MaterialIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\MaterialIcons.ttf: Error: Duplicate resources
[fonts/Octicons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Octicons.tt[fonts/Octicons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Octicons.ttf: Error: Duplicate resources
[fonts/SimpleLineIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\SimpleLineIcons.ttf [fonts/SimpleLineIcons.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\SimpleLineIcons.ttf: Error: Duplicate resources
[fonts/Zocial.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\src\main\assets\fonts\Zocial.ttf [fonts/Zocial.ttf] C:\Project_Repo\App_Frontend\IndigoLearn\android\app\build\intermediates\ReactNativeVectorIcons\fonts\Zocial.ttf: Error: Duplicate resources

  • 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.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    java.lang.StackOverflowError (no error message)

  • 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.
==============================================================================

BUILD FAILED in 42s

@NikhilMasurkar
Copy link
Author

NikhilMasurkar commented Mar 2, 2023

my package file

{
  "name": "Fin1",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android:dev": "ENVFILE=./env/.env.dev npx react-native run-android --variant=devDebug --appIdSuffix=dev",
    "android:prod": "ENVFILE=./env/.env.prod npx react-native run-android --variant=prodDebug",
    "android:prodBundle": "cd android && ENVFILE=./env/.env.prod ./gradlew clean && ./gradlew bundleProdRelease",
    "android:prodApk": "cd android && ENVFILE=./env/.env.prod ./gradlew clean && ./gradlew assembleProdRelease",
    "android:devRelease": "cd android && ENVFILE=./env/.env.dev ./gradlew clean && ./gradlew assembleDevRelease",
    "ios:dev": "ENVFILE=./env/.env.dev react-native run-ios --scheme \"Fin1Dev\" --configuration \"Dev.Debug\"",
    "codepush:androidDev": "appcenter codepush release-react -a IndigoLearn/1FIN-by-Indigolearn -d Dev -m -t 2.1.2",
    "codepush:iosDev": "appcenter codepush release-react -a IndigoLearn/1FIN-by-Indigolearn-1 -d Dev -m -t 2.1.2",
    "codepush:iosProd": "appcenter codepush release-react -a IndigoLearn-Prod/1FIN-By-IndigoLearn-1 -d Production -m -t 2.1.2",
    "codepush:androidProd": "appcenter codepush release-react -a IndigoLearn-Prod/1FIN-By-IndigoLearn -d Production -m -t 2.1.2",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "repo:cleanup": "rm -rf node_modules & rm -rf yarn.lock & yarn install & cd ios & rm -rf Podfile.lock & pod install & cd ..",
    "android:winDev": "set \"ENVFILE=./env/.env.dev\" && npx react-native run-android --variant=devDebug --appIdSuffix=dev"
  },
  "dependencies": {
    "@invertase/react-native-apple-authentication": "^2.2.2",
    "@native-html/table-plugin": "^5.3.1",
    "@react-native-async-storage/async-storage": "^1.11.11",
    "@react-native-community/datetimepicker": "^6.7.5",
    "@react-native-community/netinfo": "^9.3.7",
    "@react-native-firebase/analytics": "^17.3.0",
    "@react-native-firebase/app": "^17.3.0",
    "@react-native-firebase/crashlytics": "^17.3.0",
    "@react-native-firebase/dynamic-links": "^17.3.0",
    "@react-native-firebase/messaging": "^17.3.0",
    "@react-native-firebase/perf": "^17.3.0",
    "@react-native-google-signin/google-signin": "^9.0.2",
    "@react-native-masked-view/masked-view": "^0.2.8",
    "@react-navigation/drawer": "^6.6.0",
    "@react-navigation/native": "^6.1.4",
    "@react-navigation/stack": "^6.3.14",
    "axios": "^1.3.3",
    "lottie-ios": "^4.1.3",
    "lottie-react-native": "^5.1.5",
    "metro": "^0.75.1",
    "react": "18.2.0",
    "react-native": "0.71.3",
    "react-native-animatable": "^1.3.3",
    "react-native-calendars": "^1.1293.0",
    "react-native-canvas": "^0.1.38",
    "react-native-circular-progress": "^1.3.8",
    "react-native-code-push": "^7.1.0",
    "react-native-config": "^1.5.0",
    "react-native-deck-swiper": "^2.0.13",
    "react-native-device-info": "^10.4.0",
    "react-native-document-picker": "^8.1.3",
    "react-native-email-link": "^1.14.3",
    "react-native-exception-handler": "^2.10.10",
    "react-native-fbsdk-next": "^11.1.0",
    "react-native-file-viewer": "^2.1.5",
    "react-native-flash-message": "^0.4.0",
    "react-native-freshchat-sdk": "^4.2.1",
    "react-native-fs": "^2.20.0",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-gifted-charts": "^1.2.42",
    "react-native-hyperlink": "^0.0.22",
    "react-native-image-crop-picker": "^0.39.0",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-in-app-review": "^4.2.1",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-material-ripple": "^0.9.1",
    "react-native-modal": "^13.0.1",
    "react-native-modal-datetime-picker": "^14.0.1",
    "react-native-multicolor-progress-bar": "^2.0.0",
    "react-native-offline": "^6.0.2",
    "react-native-orientation": "^3.1.3",
    "react-native-paper": "^5.2.0",
    "react-native-pg-react-native-sdk": "^2.1.6",
    "react-native-progress": "^5.0.0",
    "react-native-razorpay": "^2.3.0",
    "react-native-reanimated": "^2.14.4",
    "react-native-render-html": "^6.3.4",
    "react-native-restart": "^0.0.27",
    "react-native-safe-area-context": "^4.5.0",
    "react-native-screens": "^3.20.0",
    "react-native-share": "^8.2.0",
    "react-native-shimmer-placeholder": "^2.0.9",
    "react-native-slider": "^0.11.0",
    "react-native-sms-retriever": "^1.1.1",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^13.8.0",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-swipeable-rating": "^0.2.1",
    "react-native-swiper-flatlist": "^3.0.18",
    "react-native-vector-icons": "^9.2.0",
    "react-native-video": "file:../Resources/vdocipher_iOS/react-native-video-fix-fairplay",
    "react-native-video-vdo": "file:../Resources/vdocipher_iOS/react-native-video-vdo-master",
    "react-native-webview": "^11.26.1",
    "react-native-youtube-iframe": "^2.2.2",
    "react-navigation-backhandler": "^2.0.1",
    "react-redux": "^8.0.5",
    "recyclerlistview": "^4.2.0",
    "redux": "^4.2.1",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.4.2",
    "vdocipher-rn-bridge": "^1.12.2"
  },
  "devDependencies": {
    "@babel/core": "^7.20.12",
    "@babel/runtime": "^7.20.13",
    "@react-native-community/eslint-config": "^3.2.0",
    "babel-jest": "^29.4.3",
    "eslint": "^8.34.0",
    "jest": "^29.4.3",
    "metro-react-native-babel-preset": "^0.75.0",
    "react-test-renderer": "18.2.0",
    "redux-logger": "^3.0.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

@NikhilMasurkar NikhilMasurkar changed the title Execution failed for task ':app:createBundleDevDebugJsAndAssets'. > Process 'command 'cmd'' finished with non-zero exit value 1 Execution failed for duplicate resources Mar 2, 2023
@robhogan
Copy link
Contributor

robhogan commented Mar 2, 2023

Hi @NikhilMasurkar - I just installed your package.json and I can see the issue, which actually caused both problems. Your dependency react-native-multicolor-progressbar (CC maintainer @areebaSami) has a dependency on react-native@0.68 (as well as react@17), which will be causing multiple versions of React, RN and Metro in your node_modules.

Remove that dependency and you should be ok.

but from the package, metro was missing, so I add the latest version of the metro now and it works

You can (and should) remove metro from your own package.json (you should keep metro-react-native-babel-preset). You'll havemetro via react-native -> @react-native-community/cli[-plugin-metro] -> metro, so you don't need to depend on it explicitly and doing so could give you problems the next time you update.

@NikhilMasurkar
Copy link
Author

hi, @robhogan do I need to uninstall this dependency? if I'll uninstall then instead which package is best?

@robhogan robhogan closed this as completed Mar 4, 2023
@robhogan
Copy link
Contributor

robhogan commented Mar 4, 2023

hi, @robhogan do I need to uninstall this dependency? if I'll uninstall then instead which package is best?

All I can tell you is that your build issues are caused by that package, rather than a bug in Metro or React Native. You'll need to decide the best approach to resolve that.

You could patch or fork the package, raise an issue there and ask the maintainer to fix it, migrate to something else, vendor the package's code into your app, or build your own. You could even get around this particular issue by forcing your package resolutions.

If you need help with any of that I'd suggest asking on StackOverflow. This isn't the place for that kind of support. Good luck!

@mittalprayag25
Copy link

Please try :

  1. watchman watch-del-all
  2. watchman shutdown-server

referenced from this source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants