title: Appcenter Codepush integration. Cannot add task 'bundleDebugJsAndAssets' as a task with that name already exists
body: <h1>Steps to Reproduce</h1>
  
  <ol>
  <li><code>yarn add react-native-codepush</code></li>
  <li>Add following to <code>android/app/build.gradle</code></li>
  </ol>
  
  <pre><code>apply from: "../../node_modules/react-native/react.gradle"
  apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
  </code></pre>
  
  <ol start="3">
  <li>Add following to <code>MainApplication.java</code></li>
  </ol>
  
  <pre class="lang-java prettyprint-override"><code>...
  import com.microsoft.codepush.react.CodePush;
  ...
          @Override
          protected String getJSBundleFile() {
              return CodePush.getJSBundleFile();
          }
  </code></pre>
  
  <ol start="4">
  <li>Add the following to <code>strings.xml</code></li>
  </ol>
  
  <pre><code>    &lt;string name="CodePushDeploymentKey" moduleConfig="true"&gt;MYKEY&lt;/string&gt;
  </code></pre>
  
  <h1>Expected Behavior</h1>
  
  <p>Build should be successful </p>
  
  <h1>Actual Behavior</h1>
  
  <p>What actually happens?</p>
  
  <pre><code> $ react-native run-android
  info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
  Jetifier found 998 file(s) to forward-jetify. Using 4 workers...
  info JS server already running.
  info Installing the app...
  
  &gt; Configure project :app
  WARNING: BuildType(debug): resValue 'react_native_dev_server_port' value is being replaced: 8081 -&gt; 8081
  WARNING: BuildType(debug): resValue 'react_native_inspector_proxy_port' value is being replaced: 8081 -&gt; 8081
  WARNING: BuildType(release): resValue 'react_native_dev_server_port' value is being replaced: 8081 -&gt; 8081
  WARNING: BuildType(release): resValue 'react_native_inspector_proxy_port' value is being replaced: 8081 -&gt; 8081
  
  Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
  Use '--warning-mode all' to show the individual deprecation warnings.
  See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
  
  FAILURE: Build failed with an exception.
  
  * Where:
  Script '/Users/user/Desktop/project/app/native/node_modules/react-native/react.gradle' line: 118
  
  * What went wrong:
  A problem occurred configuring project ':app'.
  &gt; Cannot add task 'bundleDebugJsAndAssets' as a task with that name already exists.
  
  * 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 4s
  
  error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
  Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
  
  FAILURE: Build failed with an exception.
  
  * Where:
  Script '/Users/user/Desktop/project/app/native/node_modules/react-native/react.gradle' line: 118
  
  * What went wrong:
  A problem occurred configuring project ':app'.
  &gt; Cannot add task 'bundleDebugJsAndAssets' as a task with that name already exists.
  
  * 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 4s
  
      at makeError (/Users/user/Desktop/project/app/native/node_modules/execa/index.js:174:9)
      at /Users/user/Desktop/project/app/native/node_modules/execa/index.js:278:16
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async runOnAllDevices (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
      at async Command.handleAction (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli/build/index.js:186:9)
  error Command failed with exit code 1.
  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  
  </code></pre>
  
  <h1>Environment</h1>
  
  <ul>
  <li>react-native-code-push version: ^6.2.1</li>
  <li>react-native version: 0.62.2</li>
  <li>iOS/Android/Windows version: unknown</li>
  <li>Does this reproduce on a debug build or release build? only checked on debug</li>
  <li>Does this reproduce on a simulator, or only on a physical device? build error</li>
  </ul>
  
  <h1>External SDKs</h1>
  
  <p>I do have an external SDK in <code>build.gradle</code>. I don't know if that is the reason for this error.</p>
  
  <pre><code>buildscript {
      repositories {
          maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
      }
      dependencies {
          classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'
      }
  }
  
  apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
  apply plugin: "com.android.application"
  apply from: "../../node_modules/react-native/react.gradle"
  apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
  
  ....
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  
  <h1>What I tried.</h1>
  
  <p>I moved two declarations to the bottom of <code>app/build.gradle</code>. but the error remains same</p>
  
  <pre><code>// 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)
  apply from: "../../node_modules/react-native/react.gradle"
  apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
  
  </code></pre>
  
  <p>Some article state to remove the line <code>apply from: "../../node_modules/react-native/react.gradle"</code>. But New error is </p>
  
  <pre><code>yarn run v1.22.4
  $ react-native run-android
  info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
  Jetifier found 998 file(s) to forward-jetify. Using 4 workers...
  info JS server already running.
  info Installing the app...
  
  Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
  Use '--warning-mode all' to show the individual deprecation warnings.
  See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine the dependencies of task ':app:mergeDebugAssets'.
  &gt; Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
     &gt; Could not resolve project :react-native-code-push.
       Required by:
           project :app
        &gt; Unable to find a matching configuration of project :react-native-code-push:
            - None of the consumable configurations have attributes.
  
  * 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 3s
  
  error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
  Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine the dependencies of task ':app:mergeDebugAssets'.
  &gt; Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
     &gt; Could not resolve project :react-native-code-push.
       Required by:
           project :app
        &gt; Unable to find a matching configuration of project :react-native-code-push:
            - None of the consumable configurations have attributes.
  
  * 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 3s
  
      at makeError (/Users/user/Desktop/project/app/native/node_modules/execa/index.js:174:9)
      at /Users/user/Desktop/project/app/native/node_modules/execa/index.js:278:16
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async runOnAllDevices (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
      at async Command.handleAction (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli/build/index.js:186:9)
  error Command failed with exit code 1.
  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  </code></pre>
  
  <p>I removed both line (which actually don't make any sense) the error is </p>
  
  <pre><code>yarn run v1.22.4
  $ react-native run-android
  info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
  Jetifier found 998 file(s) to forward-jetify. Using 4 workers...
  info JS server already running.
  info Installing the app...
  
  Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
  Use '--warning-mode all' to show the individual deprecation warnings.
  See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
  &gt; Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
     &gt; Could not resolve project :react-native-code-push.
       Required by:
           project :app
        &gt; Unable to find a matching configuration of project :react-native-code-push:
            - None of the consumable configurations have attributes.
  
  * 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 4s
  
  error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
  Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
  &gt; Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
     &gt; Could not resolve project :react-native-code-push.
       Required by:
           project :app
        &gt; Unable to find a matching configuration of project :react-native-code-push:
            - None of the consumable configurations have attributes.
  
  * 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 4s
  
      at makeError (/Users/user/Desktop/project/app/native/node_modules/execa/index.js:174:9)
      at /Users/user/Desktop/project/app/native/node_modules/execa/index.js:278:16
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async runOnAllDevices (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
      at async Command.handleAction (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli/build/index.js:186:9)
  error Command failed with exit code 1.
  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  
  </code></pre>