【发布时间】:2014-11-08 02:30:30
【问题描述】:
我找到了一个我想从事的开源项目,但在设置初始配置时遇到了问题。该项目似乎是用 Eclipse 编写的,我正试图让它与 Android Studio 一起工作。在经历了一些错误之后,我终于在运行之前在配置菜单中看到了以下错误。
AndroidManifest.XML doesn't exist or has the incorrect root tag
我找到了一些答案,例如 this 建议我使用 sync project with Gradle 命令,但我的项目没有使用 Gradle 设置,因为我正在构建其他人的项目。这是我第一次使用 Android Studio,所以我尝试解决这个问题的尝试可能不是很好。我决定尝试通过添加我自己的 build.gradle 和 settings.gradle 文件来使该项目成为 Gradle 项目。我的布局如下所示:
顶层:
在java文件夹内:
我尝试复制构建和设置 Gradle 文件的工作示例。我的settings.gradle 包含以下内容:
include ':'
我的顶级build.gradle 包含:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//compile project(":")
}
}
allprojects {
repositories {
mavenCentral()
}
}
我的java级别build.gradle包含:
apply plugin: 'android'
android {
compileSdkVersion 20
buildToolsVersion "17.0.0"
defaultConfig {
applicationId "org.pocketworkstation.pckeyboard"
minSdkVersion 8
targetSdkVersion 19
versionCode 1037
versionName "v1.37"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
jni.srcDirs = ['jni']
}
androidTest.setRoot('tests')
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
因为我认为这可能很重要,所以我的项目结构模块:
目前尝试同步不会产生任何单词,所以我认为这没关系,但这是一个很大的假设。有什么想法我必须改变吗?
【问题讨论】:
标签: android gradle android-studio android-gradle-plugin