我的android项目有这个结构:
ProjectDir
settings.gradle
MyApp(depends on LibraryA and LibraryB)
-->build.gradle
-->All the other android code
LibraryA (depends on LibraryB)
-->build.gradle
-->All the other android code
LibraryB (Has lots of resources that are used in LibraryA and MyApp)
-->build.gradle
-->All the other android code
Run Code Online (Sandbox Code Playgroud)
我可以使用eclipse和Android Studio编译Android应用程序.LibraryA通过执行" import com.LibraryB.R;"来导入LibraryB的R文件. 我也在com.LibraryB.R.layout....代码中使用类型引用,只要我在IDE中就可以了.
我正在尝试从我们的CI服务器的命令行构建内容,并且我已经尝试了ant和gradle,并且最终在每个中都获得了相同的构建错误.
LibraryA/example.java:10:error:cannot find symbol import com.LibraryB.R
Run Code Online (Sandbox Code Playgroud)
我甚至已经将LibraryB作为本地aar文件发布并使用它来构建LibraryA
LibraryB build.gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
group = 'com.libraryb'
version = '1.0'
apply plugin: …Run Code Online (Sandbox Code Playgroud)