与其他模块的Android Studio中的源代码编译 [英] Compiling with the source of another module in Android Studio
问题描述
在Android Studio中我有一个Android项目,其中包含一个名为走
设置与摇篮是一个Android库中的一个模块。它包含一个Java包名为 com.nwoods.go
。对于这个堆栈溢出提交的缘故,它含有一种叫类 FooBar的
搜索结果
内部同样采用Android项目,我有一个名为应用模块 ugurdemo1
具有MainActivity类别在包 com.nwoods.ugurdemo1
。
In Android Studio I have an Android project which contains an module called go
setup with Gradle to be an Android library. It contains a single Java package called com.nwoods.go
. For the sake of this Stack Overflow submission, it contains a class called FooBar
Inside the same Android project, I have an application module called ugurdemo1
which has a MainActivity class in the package com.nwoods.ugurdemo1
.
Android的工作室我已经修改了项目结构的模块 ugurdemo1
依赖于库走
在编译时。在 ugurdemo1
的MainActivity,我想引用和使用类 FooBar的
从去
。要做到这一点,我prefaced类具有典型的Java import语句:结果
Android Studio I have modified the project structure for the module ugurdemo1
to depend on the library go
at compile time. In ugurdemo1
's MainActivity, I'd like to reference and use the class FooBar
from go
. To do this, I prefaced the class with a typical Java import statement:
import com.nwoods.go.FooBar;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FooBar myFooBarObject = null;
Android的工作室还是不能做一个干净的重建我的消息来源后,解决了 FooBar的
符号。堆栈溢出类似的问题都通过编辑依赖对话框中的编译时间设置解决,但是又不能正常工作。如果是任何帮助,我目前运行的 Android的工作室IO preVIEW(0.3.6)
Android Studio still can not resolve the symbol for FooBar
after doing a clean rebuild of my sources. Similar questions on Stack Overflow were resolved by editing the compile time settings in the Dependency dialog but again that does not work. If it is of any help, I am currently running Android Studio IO Preview (0.3.6)
推荐答案
该问题可能不是你的项目但是我们在这里正在跟踪Android Studio中本身就是一个错误:的 HTTPS://$c$c.google.com/p/android/issues/detail ID = 65915
The problem may not be your project but a bug in Android Studio itself that's being tracked here: https://code.google.com/p/android/issues/detail?id=65915
修复,就是要删除所有模块settings.gradle除了根项目目录。
The "fix" is to delete the settings.gradle from all modules except the root project directory.
例如,在我的情况,我的项目结构如下所示:
For example, in my situation, my project structure looks like this:
build.gradle
settings.gradle
library_module:
build.gradle
settings.gradle
library:
build.gradle
settings.gradle
android_app:
settings.gradle
build.gradle
删除后,该结构是这样的:
After deleting, the structure looked like this:
build.gradle
settings.gradle
library_module:
build.gradle
library:
build.gradle
android_app:
build.gradle
干杯
这篇关于与其他模块的Android Studio中的源代码编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!