Android Studio Gradle 无效文件 Manifest.xml

标签 android android-studio gradle configuration android-manifest

我正在尝试在 AndroidStudio 版本 0.4.4 上构建我的 android 项目,但是在我触摸文件 build.gradle 后出现了问题,现在看起来像这样:

apply plugin: 'android'
            android {
                compileSdkVersion 19
                buildToolsVersion "19.0.1"

                defaultConfig {
                    minSdkVersion 9
                    targetSdkVersion 19
                    versionCode 1
                    versionName "1.0"
                }

                signingConfigs {
                    release {
                        storeFile file('somekey.jks')
                        storePassword "pass"
                        keyAlias "alias"
                        keyPassword "pass"
                    }
                }

                buildTypes {
                    release {
                        signingConfig signingConfigs.release
                        runProguard false
                        debuggable false
                        jniDebugBuild false
                        zipAlign true
                        renderscriptDebugBuild false
                        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
                    }

                    debug {
                        debuggable true
                        jniDebugBuild true
                        renderscriptDebugBuild true
                    }
                }
            }

            dependencies {
                compile 'com.android.support:gridlayout-v7:19.0.1'
                compile 'com.android.support:support-v4:19.0.1'
                compile 'com.android.support:appcompat-v7:+'
                compile 'com.google.android.gms:play-services:4.2.42'
            }

之前是这样的:

apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"

defaultConfig {
    minSdkVersion 8
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
}

dependencies {
    compile 'com.android.support:gridlayout-v7:19.0.1'
    compile 'com.android.support:support-v4:19.0.1'
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.google.android.gms:play-services:4.2.42'
}

现在我每次尝试运行我的项目时都会收到此错误:

Throwable: Invalid file: file://C:/Users/user/AndroidStudioProjects/myprojectname/myproject/build/manifests/debug/AndroidManifest.xml

有人知道如何解决这个问题吗?

最佳答案

巧合的是,当我对你的问题发表评论时,我也遇到了同样的错误,我自己解决了它。

File > Invalidate Caches/Restart

解决了我的问题。

关于Android Studio Gradle 无效文件 Manifest.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21794087/

相关文章:

java - 使用 Retrofit 2 发送带有 url 参数的帖子

android - 如何在 Dialog 中正确使用 FragmentResultListener

java - 如果其他参数不起作用?

android - 用Kotlin执行房间时出现错误

java - 请参阅调试期间真实设备中的共享首选项 xml 文件

java - "Default FirebaseApp is not initialized"错误发生在模块依赖的静态帮助方法中

oracle - gradle jettyrun oracle 找不到合适的驱动程序

android - 谷歌地图 api key 不工作 v2

android - 如何在 Android Studio 中添加 'libs' 文件夹?

java - 任务 ':compileJava'的执行失败。 Gradle