java - AndroidManifest.xml - 指定的属性 'manifest' 不存在

标签 java android xml gradle

这是我遇到的错误,而且从我在 StackOverflow 上搜索的内容来看似乎无法修复。

Error:A problem was found with the configuration of task ':checkDebugManifest'.
> File '/Users/wasimsandhu/AndroidStudioProjects/Conjugation/src/main/AndroidManifest.xml' 
specified for property 'manifest' does not exist.

每次重建项目或同步 Gradle 文件时,我都会收到此错误。我在这里尝试了各种其他线程中的解决方案,但无济于事。

这是我的 app/build.gradle 文件:

apply plugin: 'com.android.application'

android {
signingConfigs {
    config {
        // removed for this post
    }
}

compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
    applicationId "com.wsandhu.conjugation"
    minSdkVersion 15
    targetSdkVersion 19
    versionCode 1
    versionName "0.5"
}

buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.+'
    compile 'de.cketti.library.changelog:ckchangelog:1.2.1'
    compile 'com.nispok:snackbar:2.0.1'
}

这是根目录中的 build.gradle 文件:

apply plugin: 'com.android.application'

// 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:0.13.2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
}

allprojects {
repositories {
    jcenter()
}
}

android {
compileSdkVersion 21
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.wsandhu.conjugation"
    minSdkVersion 15
    targetSdkVersion 19
    versionCode 1
    versionName "0.5"
    }
}

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.wsandhu.conjugation" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

这里是 gradle 包装文件,以防万一:

#Mon Nov 17 20:04:45 PST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip

对于错误的格式或任何不清楚的地方,我提前表示歉意。

最佳答案

从根目录中的 build.gradle 中删除这段代码

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.wsandhu.conjugation"
    minSdkVersion 15
    targetSdkVersion 19
    versionCode 1
    versionName "0.5"
    }
}

正如它所说:

//注意:不要将您的应用程序依赖项放在这里;它们属于单独的模块 build.gradle 文件

意思是这行代码会转到应用文件夹内的 gradle 文件中。

试着像这样制作你的顶级 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:1.5.0'
    }

}

allprojects {
    repositories {
        jcenter()
    }
}

我之前遇到过同样的问题。所以我认为这会解决你的问题。

关于java - AndroidManifest.xml - 指定的属性 'manifest' 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26988235/

相关文章:

Java POST 数据到 mySQL UTF-8 编码问题

java - 尝试使用泛型延迟加载 android View

xml - 检查祖先属性值是否是某个值

c# - 返回非常大的字符串时 .asmx 请求超时

java - 如何在log4j2 xml中配置WriterAppender?

java - LinkedHashMap LRU 缓存 - 确定删除了哪些值?

java - 了解 TCP 中的缓冲

android - 如何为可扩展列表的 child 实现不同的点击事件?

android - 如何激活列表 Activity 中的复选标记?

android - EditTextPreference inputType=textPassword 不工作