This is the way that use to exclude some transitive dependency.
compile('com.facebook.android:facebook-android-sdk:4.22.0') { exclude group: 'com.android.support', module: 'support-v4' exclude group: 'com.android.support', module: 'appcompat-v7' }
When come to project type dependency this is the way.
compile (project(':library:view_pager_indicator')) { exclude group: 'com.android.support', module: 'support-v4' exclude group: 'com.android.support', module: 'appcompat-v7' }
Keep in mind the additional brackets around project. (project(‘:library:view_pager_indicator’))