Erik Z
Erik Z

Reputation: 4780

How to include RxAndroid in project?

I'm using Android Studio. How can I include RxAndroid in my project as a subproject? I want to build it from the sourcecode. What I've tried: -Include it as a git submodule. -included it in my projects settings.gradle file, "include ':rxandroid', ':app'"

Then I get: Error:Unable to find module with Gradle path ':rxandroid'.

Edit

My folder structure is as follows.

Project
-app
-rxandroid

Edit 2

I changed the folder name from rxandroid to RxAndroid. I also changed the name in the projects settings.gradle, but I still get the same error.

Upvotes: 1

Views: 667

Answers (1)

mindex
mindex

Reputation: 1636

According to http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Multi-project-setup it should simply work by changing settings.gradle to:

include ':app', ':RxAndroid'

And it does work for me. My setup is

EDIT:

I should mention that I'm still running Gradle 1.12. I created a new blank project in Android Studio, added RxAndroid to settings.gradle, and a build error appeared:

Error:Cause: startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/path/spock-core/0.7-groovy-1.8/3a677d19e8d3acf3bd296c4023356256d55da5a3/spock-core-0.7-groovy-1.8.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation  because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 0.7.0-groovy-1.8 is not compatible with Groovy 2.3.6. For more information, see http://versioninfo.spockframework.org
Spock location: file:/path/spock-core-0.7-groovy-1.8.jar
Groovy location: file:/path/gradle-2.1/lib/groovy-all-2.3.6.jar

It seems RxAndroid depends on Spock 0.7-groovy-1.8 which won't work with Groovy 2.3.6 of Gradle 2.1. And the latest com.android.tools.build (0.13.x) requires Gradle 2.1.

So I did the following:

  • in the top level build.gradle (not the app one) change the project's dependency on com.android.tools.build back to 0.12.+
  • change the Gradle version in gradle-wrapper.properties back to 1.12

Now the project built successfully.

Upvotes: 2

Related Questions