How to include RxAndroid in project? - android

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.

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
Android Studio 0.8.13
RxAndroid cloned from https://github.com/ReactiveX/RxAndroid
My project is using com.android.tools.build:gradle:0.12.+
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.

Related

how resolve gradle error "This project does not use the Gradle build system"

I cloned a project from Github when i try to build the project an error shown in android studio ."This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.
More Information about migrating to Gradle
Don't show this message again".it's seem this projects it's not created witha android studio
If you clone by
VCS -> Checkout from Version Control
Maybe you should try File -> New -> Project From Version Control -> Git
Hope this might help in your problem.
In the root directory,
Place a settings.gradle and have the following content
include 'android'
include 'core'
Also you may want to put a build.gradle in the root folder as well..

gradle error in unity exported android project

I am going to use the build config property "multiDexEnabled true" to break 64K methods limit following link
https://developer.android.com/studio/build/multidex.html#about
I update to use unity 5.6.1f1 and android studio 2.3.3. I set "build system" option to "Gradle(New)", which is new added from 5.5, then click "Export" to create an android project.
I open the exported project with android studio, then I get the following error
I try the two blue links, but I keep geting this same result.
For my unity project, I only create an empty project and add a button to a unity scene, then export it. I have also tried to build API directly, it works.
It is important for me to export unity project to andoid studio project, because it can help us to use additional compile options
Do any one know what I miss? Or how to export unity project correctly?
Thanks
The gradle error text, if cannot see the image link
Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I had the same issue with unity 2017.1.0b4 and Android Studio 2.3.3, gradle 3.3.
You should change android plugin for graddle version in Android studio to 2.3.3
You can specify the Android plugin for Gradle version in either the
File > Project Structure > Project menu in Android Studio, or the
top-level build.gradle file. The plugin version applies to all modules
built in that Android Studio project. The following example sets the
Android plugin for Gradle to version 2.3.3 from the build.gradle file:
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
https://developer.android.com/studio/releases/gradle-plugin.html
Check your local gradle version in directory -
C:\Users\yourname\.gradle\wrapper\dists
Modify your project gradle configuration -
project\gradle\wrapper\gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Make sure gradle-3.3-all match to your gradle version.
If you have wasted a lot of time fixing unity Gradle error but nothing worked then you tried unity internal builder but that gave "Parsing Package error"
then try this, it will not help you make your project using unity's Gradle but it will make your project without any error successfully.
Export your project from unity to a folder eg: ProjectName_Gradle.
open android studio, make sure you are connected to the internet .
close current project then select "Open Gradle, eclipse ADT, etc;" option and open ProjectName_Gradle folder.
check the version of buildTools installed in your android-SDK by opening android-SDK settings from the android studio itself.
edit "build.gradle" file under Gradle Scripts section or under your project.
and change "buildToolsVersion" to the latest version installed in your SDK.
then click "syn project with Gradle Files" from file option and let it sync.
it may ask to update Gradle version, then click update
now there should not be any errors.
now try building APK.

Import a project to Android studio faced problems

I want reading an open source project so I select k9mail for start. The recommendation was run and reading this code in Android Studio. I import k9mail project to AS 1.2.1.1 version. I download gradle 2.4 version and added this in environment variable. When I want to run this application, but I receive some errors that I describe below:
1) When I click Run (Alt+Shift+F10), select Android Application, select my module (there is k9mail) and select USB Device, then I see a warning:
No JDK specified for module 'k-9-master'.
2) When I click on Run (Shift+F10), I faced this error in messages tab:
Gradle DSL method not found: 'android()'
Possible causes:
A)The project 'k-9-master' may be using a version of Gradle that does not contain the method.Open Gradle wrapper file
B)The build file may be missing a Gradle plugin. Apply Gradle plugin
When I updated gradle to 2.4, I changed classpath 'com.android.tools.build:gradle:1.2.3' to 'classpath 'com.android.tools.build:gradle:2.4'' from build.gradle of k9mail, but my problems were not solved.
I googled but I can't find solutions for my problems.
No jdk specified for the module.
For that you have to specify the jdk path through Project Structure.
You may also verify by looking at local.properties
For gradle related issues you just kindly update your gradle build and SDKs to latest versions.
This will minimize your gradle issues.

Android Studio 0.4.3 - Unable to compile official Android Samples

I've got Android Studio 0.4.3 installed on my system and try to import and run the official samples from the Android Developers site:
http://developer.android.com/samples/index.html
Unfortunately when I try to compile I get the following error:
FAILURE: Could not determine which tasks to execute.
What went wrong: Task 'assemble' not found in root project 'ActionBarCompat-Basic'.
Try: Run gradle tasks to get a list of available tasks.
As you can see I tried to compile the ActionBarCompat-Basic example, but the result is the same for all samples.
I already tried to delete the <component name="FacetManager"> ... </component>
from my iml file and deleted the .idea folder like suggested in this thread:
Gradle: FAILURE: Could not determine which tasks to execute
This did not solve the problem. After removal of the files I imported the project to Android Studio and tried to compile. As a consequence the iml file and the .idea folder are generated again and the error message stays the same.
Anyone else got this problem? Any help is greatly appreciated!
Sample projects are using old version of gradle plugin which is no longer supported by Android Studio 0.4.3
Please do the following changes
Go to your module's build.gradle(like ActionBarCompat-BasicSample/build.gradle) file inside the project and replace dependency classpath at beginning by this
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
Change the distrubutionUrl in ActionBarCopat-Basic/gradle/gradle-wrapper.properties file to this
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
If you are using gradle version 1.10 replace 0.7.+ to 0.8.+ and 1.9 to 1.10 in above configurations .
I am assuming you have already removed component FacetManager from ActionBarCopat-Basic.iml file and re-imported the project.
This worked perfectly for me.

Error when importing a Gradle project into Android Studio

I am trying to import a Gradle project into Android Studio and get the following error:
This project does indeed compile when I run Gradle from the command line. I can also Open the project in Android Studio (vs Import) but then it tries to build using the Eclipse build script.
The gradle build was created by hand and not via the Eclipse export function.
My problem can be resolved in one of two ways:
1) Tell me how to force Android Studio to use Gradle instead of using the Eclipse build.
2) Help me find the reason for the Gradle import error.
I am using
Android Studio 0.2.2
Gradle 1.6 via gradlew
I finally found out why this didn't work.
There are two ways to include a project from within the settings.gradle file:
include ':..:source:compA-api'
and
include "source:compA-api"
project(':source:compA-api').projectDir = new File(settingsDir, 'source/compA/api')
I had used the second form and apparently Android Studio didn't like that :)

Categories

Resources