Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更新Android studio后,Android资源编译失败_Android_Android Studio_Gradle_Android Gradle Plugin_Build.gradle - Fatal编程技术网

更新Android studio后,Android资源编译失败

更新Android studio后,Android资源编译失败,android,android-studio,gradle,android-gradle-plugin,build.gradle,Android,Android Studio,Gradle,Android Gradle Plugin,Build.gradle,我刚刚将我的android studio更新为3.2.1版,并通过android studio将我的gradle更新为最新版本,但构建项目面临以下错误: Android资源编译输出失败: D:\projects\myProject\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2577: 错误:内部元素必须是资源引用或 空的。 D:\projects\myProject\a

我刚刚将我的android studio更新为3.2.1版,并通过android studio将我的gradle更新为最新版本,但构建项目面临以下错误:

Android资源编译输出失败: D:\projects\myProject\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2577: 错误:内部元素必须是资源引用或 空的。 D:\projects\myProject\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2585: 错误:内部元素必须是资源引用或 空的

命令: C:\Users\Hamed.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\ea639d8248f3ebb66b449dfd3b6a9a07\aapt2-3.2.1-4818971-windows\aapt2.exe 编译——遗产\ -o\ D:\projects\myProject\app\build\intermediates\res\merged\debug\ D:\projects\myProject\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml 守护程序:AAPT2 AAPT2-3.2.1-4818971-windows守护程序#0

在这一行,它说有一个错误,这个代码存在:

项目级梯度:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.my.project"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "0.7"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [onesignal_app_id               : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]
    }
    applicationVariants.all { variant ->
        variant.resValue "string", "versionName", variant.versionName
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    jcenter()
}
dependencies {
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    //    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //    compile 'im.crisp:crisp-sdk:0.1.10'
    implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
    implementation 'com.stephentuso:welcome:1.4.1'
    implementation 'co.ronash.android:pushe-base:1.4.0'
    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    //    compile 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation('io.socket:socket.io-client:1.0.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }
    implementation 'com.android.volley:volley:1.1.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}


configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '28.+'
            }
        }
    }
}

apply plugin: 'com.google.gms.google-services'
repositories {
        google()
        maven { url 'https://maven.google.com' }
        jcenter()
        mavenCentral()
        buildscript {
            repositories {
                google()
                jcenter()
            }
            dependencies {
                classpath 'com.android.tools.build:gradle:3.2.1'
                classpath 'com.google.gms:google-services:4.0.1'
            }
        }

        allprojects {
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

更新

我使缓存失效并重新启动了Android studio,问题得到了解决,但我遇到了以下错误:

> Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71.
> Searched in the following locations:
>     https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.71/kotlin-stdlib-jdk8-1.2.71.pom
>     https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.71/kotlin-stdlib-jdk8-1.2.71.jar
>     https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.71/kotlin-stdlib-jdk8-1.2.71.pom
>     https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.71/kotlin-stdlib-jdk8-1.2.71.jar
> Required by:
>     project : > com.android.tools.build:gradle:3.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.lint:lint-gradle-api:26.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:gradle-api:3.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > androidx.databinding:databinding-compiler-common:3.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1 >
> com.android.tools:sdk-common:26.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1 >
> com.android.tools:common:26.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1 >
> com.android.tools.build:manifest-merger:26.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1 >
> com.android.tools:sdklib:26.2.1 > com.android.tools:repository:26.2.1
关键是我根本没有使用Kotlin。我添加了
classpath“org.jetbrains.kotlin:kotlin gradle plugin:1.2.71”
,但会出现相同的错误。我在整个项目中搜索了
Kotlin
,但除了一些
replay_pid1632.log
文件外什么都没有


tnx

我认为您不应该给id类型资源赋值。改变

<item name="googledefaultpass" type="id">123456789</item>

to 

<item name="googledefaultpass" type="id"/>
123456789
到

我认为您不应该给id类型资源赋值。改变

<item name="googledefaultpass" type="id">123456789</item>

to 

<item name="googledefaultpass" type="id"/>
123456789
到
尝试添加

classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71'
在项目级渐变依赖项中,然后添加

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.71'
在您的应用程序级别渐变中。 可能您的某个库需要kotlin插件。

尝试添加

classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71'
在项目级渐变依赖项中,然后添加

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.71'
在您的应用程序级别渐变中。 可能您的某个库需要kotlin插件。

id
不能有值

因此,改变:

<item name="googledefaultpass" type="id">123456789</item>
也可以删除此重复的依赖项:

implementation fileTree(include: ['*.jar'], dir: 'libs')
id
不能有值

因此,改变:

<item name="googledefaultpass" type="id">123456789</item>
也可以删除此重复的依赖项:

implementation fileTree(include: ['*.jar'], dir: 'libs')

您是否尝试使缓存无效并重新启动?删除项目->应用->生成文件夹。如果您不能直接删除它,那么您可以删除所有内部文件夹,如生成、中间、输出等。。。然后执行无效缓存/重新启动。@Alex请检查我的后期更新好吗?tnx@RumitPatel请检查我的帖子更新好吗?tnxI无法理解为什么会出现kotlin错误。你可以根据我的第一个评论再做一次。或者,您可以尝试将所有gradle依赖项更新为最新版本。是否尝试使缓存无效并重新启动?删除项目->应用程序->生成文件夹。如果您不能直接删除它,那么您可以删除所有内部文件夹,如生成、中间、输出等。。。然后执行无效缓存/重新启动。@Alex请检查我的后期更新好吗?tnx@RumitPatel请检查我的帖子更新好吗?tnxI无法理解为什么会出现kotlin错误。你可以根据我的第一个评论再做一次。或者您可以尝试将所有gradle依赖项更新为最新版本。可能您的任何依赖项都在使用Kotlin,不确定。请尝试此操作,可能您的任何依赖项正在使用Kotlin,不确定。请试试这个