簡體   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