【发布时间】:2016-07-31 20:49:15
【问题描述】:
我的项目结构不正确。我需要一个顶级 build-gradle,以及一个包含自己的 build.gradle 的同一级别的模块。
查看现在组织方式的图片。你看到的几乎是两个不同的层级合并到了 on.e 这里的build.gradle 是项目中唯一的一个。你看到的那个有注释,它是顶级版本。
解决这个问题的正确方法是什么?我需要重新导入还是可以重新组织它?
其他信息,我已经安装了 Gradle 2.10。
编辑:更多信息
我的顶级 Gradle 文件通常包含以下内容:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
但是在上面的设置中,没有第二个 Gradle 文件,我应该把其他信息放在哪里 ...例如:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
}
android {
defaultConfig {
// edited
}
dependencies {
// edited
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apply plugin: 'com.google.gms.google-services'
当我运行程序时,我得到这个错误:
Error:A problem was found with the configuration of task ':checkDebugManifest'.
> File 'C:\--\src\main\AndroidManifest.xml' specified for property 'manifest' does not exist.
这有关系吗?
【问题讨论】:
-
你导入了eclipse项目吗?
-
@Nikhil 我相信这就是最初的样子。我已经在当前状态下使用它一段时间并发布更新。但我试图改变一些东西,并在处理 gradle 文件时发现了一些问题。
-
这绝对是可以修复的,但我没有抓住重点,所以我不知道你想往哪个方向发展。你为什么不喜欢它的样子?我认为像 AS 向导那样拥有一个额外的 gradle 文件是人为的。您是否尝试过创建一个新项目并模仿其结构?
-
你为什么还有
gen文件夹? -
@EpicPandaForce 看起来像 eclipse 继承
标签: android android-studio android-gradle-plugin