简体   繁体   中英

Can't build project after adding RxJava to dependencies

I've seen hundreds of stackoverflow questions with this exact error, but none of which could help me.

I know there's a problem with dependencies, but I can't point a finger to it.

My dependencies

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.jpardogo.materialtabstrip:library:1.0.9'
compile('com.crashlytics.sdk.android:crashlytics:2.2.2@aar') {
    transitive = true;
}
compile 'com.helpshift:android-aar:3.8.0'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.github.kierans:ViewPagerIndicator:138e5f5bd9'
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.balysv:material-ripple:1.0.2'
compile 'it.neokree:MaterialNavigationDrawer:1.3.3'
compile 'pl.charmas.android:android-reactive-location:0.6@aar'
compile 'io.reactivex:rxjava:1.0.10'
}

Error

Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\\Program Files\\Java\\jdk1.8.0_40\\bin\\java.exe'' finished with non-zero exit value 2

This error appears right after I add RxJava to dependencies. Any idea how to fix this?

Taking into account the number of dependencies you have in your build.gradle , the most possible reason for having this error is an androids 65k methods limit. There are several ways to fix the error, which are described in the official documentation .

I think the easiest way is to get rid of com.google.android.gms:play-services:7.3.0 dependency and replace it with parts you are really needed ( here is how you can do it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM