多模块项目中缺少顶层build.gradle [英] Missing top-level build.gradle in multi-module project
问题描述
我的项目中缺少顶级"项目build.gradle脚本:
I'm missing the "Top-Level" project build.gradle script from my project:
我从一个非常复杂的Maven/Eclipse项目将其导入Android Studio,它基本上在目录的顶层创建了一个模块("android"),并添加了所有子模块("tappurwear","shared"等)添加到该原始模块的目录中.
I imported it into Android Studio from a very complex Maven/Eclipse project, and it basically made a module ("android") in the top level of the directory, and added all the submodules ("tappurwear", "shared", etc) into that original module's directory.
我知道这是一种混乱的结构,但是还有很多其他构建脚本,所以我不能真正将所有文件都移到适当的单独模块中.
I know this is a kind of messed up structure, but there's a lot of other build scripts so I can't really just move all the files into a proper separate module.
所以现在我想知道,如何为整个项目添加顶级build.gradle脚本?我见过的通常的Android Studio项目只有一个,但它会将我的顶级构建脚本视为"android"模块的构建脚本.我可以创建一个新的build.script作为与其他模块共享设置的顶级项目脚本吗?有什么方法可以重命名在Android Studio或Gradle中所有其他模块脚本中使用的顶级构建脚本?
So now I'm wondering, how do I add a top-level build.gradle script, for the entire project? The usual Android Studio projects I've seen just have one, but it's treating my top-level build script as the "android" module's build script. Can I create a new build.script to be the top-level project script that shares settings with the other modules? Is there a way I can rename the top-level build script that gets used in all other module scripts, in Android Studio or Gradle?
推荐答案
我在多模块项目中遇到了同样的问题,该解决方案对我有用.
I had the same issue on my multi-module project, this solution worked for me.
- 关闭了所有打开的项目.
- 从欢迎使用Android Studio"窗口中的最新项目中删除了项目.
- 现在单击打开现有的android studio项目"&浏览到项目仓库选择顶级
build.gradle
.
这篇关于多模块项目中缺少顶层build.gradle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!