I have an Android project that will not build in Android Studio (builds fine in Eclipse).
The issue is with the library modules. The project setup is as follows:
App project (has dependency on all other modulus)
Library Module A (Domain Layer, has database business objects etc.)
Library Module B (dependency on Module A, contains views workflow pertaining to B)
Library Module C (Dependency on Module A, contains views and workflow pertaining to C)
As stated, this works fine in Eclipse (probably because of a different build system - not Gradle)
When moving to Android Studio (latest verstion 1.0.2) I gradually moved the modules over App, then A, then B, then run and everything works great. Added C, but gradle build will not work as module C cannot fine the R file for Module B (I have some share generic layouts).
However, the IDE has no issues at all. This lead me to suspect that it is an issue with the Gradle build scripts, possibly not moving the module B R-File where it can be found.
The gradle build error is:
error: package moduleA.R does not exist
This error is only when building moduleC
App dependencies section of Gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':moduleA')
compile project(':moduleB')
compile project(':moduleC')
}
dependencies for Module C:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
provided project(':ModuleA')
}
Setting.gradle: (:daogenerator is just for greeendao stuff)
include ':app', ':moduleA', ':daogenerator', ':moduleB, ':moduleC'
The one thing I do notice is in the app.iml file the orderEnty looks off, but this is generated by the IDE so any edits are over written:
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="opencsv-2.0" level="project" />
<orderEntry type="library" exported="" name="greendao-1.3.7" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="module" module-name="moduleC" exported="" />
<orderEntry type="module" module-name="moduleA" exported="" />
<orderEntry type="module" module-name="moduleB" exported="" />
Somehow I would expect the orderEntry for ModuleC to be after ModuleA; however, I don't know of to specify that.
I have not tried to build outside of the Android Studio, may attempt that when I get time. In the meantime I'm just put the port on hold and continue to develop in Eclipse.