繁体   English   中英

values.xml中的Android资源编译错误

[英]Android resource compilation error in values.xml

我收到如下所示的错误,它只是突然出现,我不知道该怎么办,我尝试将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> 

应用程式摇篮-

 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' } 

项目摇篮-

 // 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>--> 

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM