java - Values.xml中的Android资源编译错误

标签 java android android-resources

我收到如下所示的错误,它突然出现,我不知道该怎么办,我尝试将 Complile sdk 更改为 29,删除了一些未使用的 res 文件。重新启动 android studio 但还是一样

错误 -

Android resource compilation failed
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1096: error: :style>.
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1101: error: :style>.
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1106: error: :style>.
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1110: error: :style>.
E:\NotificationLog\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml: error: file failed to compile.

Values.xml(错误部分)-

      <!--  <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>-->
        <style name="parent">
            <item name="android:layout_width">match_parent</item>
            <item name="android:layout_height">wrap_content</item>
        </style>

        <style name="viewParent">
            <item name="android:layout_width">wrap_content</item>
            <item name="android:layout_height">wrap_content</item>
        </style>

        <style name="parent.TextLayout">
            <item name="android:layout_marginLeft">15dp</item>
        </style>

        <style name="modifiedEditText" parent="parent">
            <item name="android:textSize">@dimen/newsMoreTextSize</item>
        </style>

应用程序 Gradle -

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.appnotification.notificationhistorylog"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 110
        versionName "1.1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

        manifestPlaceholders = [
                onesignal_app_id               : 'ID',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE']
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
    implementation 'androidx.preference:preference:1.1.0-alpha05'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha05'

    implementation 'com.google.android.material:material:1.1.0-alpha07'
    implementation 'com.google.android.gms:play-services-location:16.0.0'

    implementation 'com.android.support:multidex:1.0.3'
    //gif
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'

    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    //Showcase
    implementation 'com.github.mreram:showcaseview:1.1'

    //Fav

    implementation 'com.github.ivbaranov:materialfavoritebutton:0.1.5'
    implementation 'com.google.firebase:firebase-core:17.1.0'

    // (Recommended) Add Analytics
    implementation 'com.google.firebase:firebase-analytics:17.1.0'

    // Add dependency
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

    implementation 'com.quinny898.library.persistentsearch:library:1.1.0-SNAPSHOT'
    // implementation 'com.google.firebase:firebase-appindexing:10.0.1'
    //implementation 'com.android.installreferrer:installreferrer:1.0'

    //Firebase
    implementation 'com.firebaseui:firebase-ui-database:4.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-auth:18.1.0'
    implementation 'com.google.firebase:firebase-database:18.0.1'
    implementation 'com.google.firebase:firebase-storage:18.1.1'
    implementation 'com.github.aakira:expandable-layout:1.6.0@aar'
    implementation 'com.google.firebase:firebase-perf:19.0.0'
    implementation 'com.onesignal:OneSignal:[3.11.2]'
    //implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.0'

    //remote
    implementation "com.google.firebase:firebase-config:19.0.0"

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.gms:play-services-ads:18.1.1'
    implementation 'com.google.firebase:firebase-messaging:20.0.0'
}

项目 Gradle-

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public'}


    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'com.google.firebase:perf-plugin:1.3.1'
        classpath 'io.fabric.tools:gradle:1.30.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public'}
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
        maven

                {
                    url "https://maven.google.com"
                }
        maven
                {
                    url "https://jitpack.io"
                    //Jitpack
                }

    }
}

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

如果有人可以帮助我,我在这里找不到路

最佳答案

我通过从 style.xml 文件中删除以下代码解决了这个问题

 <!-- <style name="parent">
            <item name="android:layout_width">match_parent</item>
            <item name="android:layout_height">wrap_content</item>
        </style>

        <style name="viewParent">
            <item name="android:layout_width">wrap_content</item>
            <item name="android:layout_height">wrap_content</item>
        </style>

        <style name="parent.TextLayout">
            <item name="android:layout_marginLeft">15dp</item>
        </style>

        <style name="modifiedEditText" parent="parent">
            <item name="android:textSize">@dimen/newsMoreTextSize</item>
        </style>-->

我错误地在错误的位置添加了样式。 :)

关于java - Values.xml中的Android资源编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57894245/

相关文章:

android - 锚定 PopupWindow 和 SOFT_INPUT_ADJUST_RESIZE android

android - 获取图像的元数据 - Android

android - Resources$NotFoundException 用于 Vivo 设备上的少数 Drawable

java - 你真的能用 GoF 设计模式构建一个快速的文字处理器吗?

java - 在 arraylist 中搜索 LocalDateTime 范围

java - 如何关闭 Eclipse Photon 中的 "Visible only for test sources"功能?

android - Android中 Activity 之外的文本本地化?

java - 从 servlet 和 jsp 打印到 txt 文件

Android Room Kotlin 内部连接

Android 发布版本 - MissingDefaultResource "error"