多模块项目中缺少顶级 build.gradle [英] Missing top-level build.gradle in multi-module project

查看:54
本文介绍了多模块项目中缺少顶级 build.gradle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中缺少顶级"项目 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.

  1. 关闭所有打开的项目.
  2. 从欢迎使用 Android Studio"窗口中最近的项目中删除了项目.
  3. 现在点击打开现有的android studio项目"&浏览到项目 repo &选择顶级build.gradle.

这篇关于多模块项目中缺少顶级 build.gradle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆