如何解决Android的工作室错误的位置无法找到该项目的清单文件? [英] How to resolve the Android Studio error where it cannot find the project's Manifest file?

查看:240
本文介绍了如何解决Android的工作室错误的位置无法找到该项目的清单文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我迁移我从Eclipse的遗留项目到Android工作室。我做了以下几件事:

I am migrating my legacy project from Eclipse to Android studio. I did the following things:

  • 导出并产生月食摇篮构建文件
  • 导入Gradle.build文件中的机器人工作室
  • 改变我的摇篮版本的依赖关系:com.android.tools.build:gradle:0.9 +类路径

我的根目录下的项目文件夹中包含3个库项目: Actionbarsherlock Authbahn 。我的根文件夹中还包含一个名为主体工程 JohelpenHulpverlener

My root folder of the project contains 3 library projects: Actionbarsherlock, Authbahn and library. My root folder also contains the main project called JohelpenHulpverlener.

解决了很多错误,我得到以下错误后:

After resolving a lot of errors I get the following error:

Error:A problem was found with the configuration of task ':checkDebugManifest'.
> File 'C:\android\jeugdformaat\JohelpenHulpverlener\AndroidManifest.xml' specified for property 'manifest' does not exist.

我的根build.gradle看起来是这样的:

My root build.gradle looks like this:

// 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.9.+'
    }
}

apply plugin: 'android'

dependencies {
    compile files('libs/android-support-v4.jar')
    compile project(":actionbarsherlock")
}

android {
    compileSdkVersion 17
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 19
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

我在主项目build.gradle看起来是这样的:

My build.gradle in the main project looks like this:

apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':library')
    compile project(':actionbarsherlock')
    compile project(':autobahn')
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

我想明白这一点,希望有人能帮助我在这里!

I am trying to understand this, hopefully someone can help me out here!

推荐答案

您已经有了一堆东西在你的根级别的摇篮构建文件,该文件使得构建系统认为有一个Android模块存在(它不是,它是一个下面的子目录里面的 JohelpenHulpverlener ),以及它的失败,因为它没有找到该清单。

You've got a bunch of stuff in your root-level Gradle build file that's making the build system think there's an Android module there (it's not; it's a subdirectory below inside JohelpenHulpverlener) , and it's failing because it's not finding the manifest.

我认为,如果你采取了很多的东西,你的根级别的 build.gradle 的文件,并将其与默认版本的新项目,这是本替换:

I think if you take a lot of stuff out of your root-level build.gradle file and replace it with the default version for new projects, which is this:

// 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.9.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

它会工作。

这篇关于如何解决Android的工作室错误的位置无法找到该项目的清单文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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