title: How to apply dependencies for all child projects/modules Gradle Android Studio
body: <p>I am newbie in gradle scripts, have only basic knowledge.<br>
  I have multiple modules inside my project. Here is screenshot.<br>
  <img src="https://i.stack.imgur.com/kgO7t.png" alt="enter image description here"></p>
  
  <p>In my project <code>build.gradle</code> file I have basic configuration.<br>
  As far as I know this file is for global project configuration.   </p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
      repositories {
          jcenter()
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:1.2.3'
          classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          maven { url "http://dl.bintray.com/populov/maven" }
          jcenter()
          mavenCentral()
          maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
  
      }
  }
  </code></pre>
  
  <p>All my module <code>build.grade</code> files have different dependencies. For instance.  </p>
  
  <pre><code>dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      //noinspection GradleDependency
      compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
      compile 'com.etsy.android.grid:library:1.0.5'
      compile 'com.squareup.picasso:picasso:2.3.2'
      compile 'com.nineoldandroids:library:2.4.0'
      compile 'com.fasterxml.jackson.core:jackson-databind:2.5.3'
      compile 'com.fasterxml.jackson.core:jackson-core:2.5.3'
      compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.3'
      compile 'com.android.support:support-v4:22.2.0'
      compile 'com.github.ksoichiro:android-observablescrollview:1.5.1'
      compile 'com.viewpagerindicator:library:2.4.1@aar'
      compile 'com.android.support:cardview-v7:21.0.3'
      compile 'com.android.support:recyclerview-v7:21.0.3'
      compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
      compile('com.mikepenz.materialdrawer:library:2.9.7@aar') {
          transitive = true
      }
      compile project(':horizontalrecyclerview')
      compile project(':ultimaterecyclerview')
      compile 'org.lucasr.twowayview:core:1.0.0-SNAPSHOT@aar'
      compile 'org.lucasr.twowayview:layouts:1.0.0-SNAPSHOT@aar'
      compile 'com.yqritc:recyclerview-flexibledivider:1.2.4'
      compile 'de.greenrobot:eventbus:2.4.0'
      compile 'com.malinskiy:superrecyclerview:1.1.0'
      compile 'com.android.support:support-v4:22.2.0'
      compile 'com.android.support:appcompat-v7:22.2.0'
      compile 'com.android.support:recyclerview-v7:22.1.1'
  }
  </code></pre>
  
  <p>What is the problem ? Some of my modules require the same library dependency, or all modules require the same library. When I add dependency to each module <code>build.gradle</code> file, I get next error while project build. </p>
  
  <pre><code>Error:Execution failed for task ':app:processDebugResources'.
  &gt; Error: more than one library with package name 'com.mikepenz.iconics'
    You can temporarily disable this error with android.enforceUniquePackageName=false
    However, this is temporary and will be enforced in 1.0
  </code></pre>
  
  <p>How can I solve this problem ? Add dependency into the root <code>build.gradle</code> file or some other solution.<br>
  Or simply follow advice and set</p>
  
  <pre><code>android.enforceUniquePackageName=false
  </code></pre>