找不到与给定名称dialogCornerRadius相匹配的资源

时间:2019-01-10 23:23:22

标签: android react-native

Failed to generate resource table for split ''
/Users/me/.gradle/caches/transforms-1/files-1.1/appcompat-v7-28.0.0.aar/5350756d4feccc54333994727594933b/res/values-v28/values-v28.xml:5:5-8:13: AAPT: No resource found that matches the given name (at 'dialogCornerRadius' with value '?android:attr/dialogCornerRadius').

我一生无法解决该问题。这仅在我构建应用程序的发行版时发生。以下是我当前使用的版本。

implementation "com.android.support:appcompat-v7:28.0.0"
compileSdkVersion 28
buildToolsVersion "28.0.0"

1 个答案:

答案 0 :(得分:0)

好的,我要回答这个问题(我在15分钟前发表评论),因为我有一个(肮脏的)解决方案。您可能拥有releasereleaseStaging对吗? assembleRelease通过时assembleReleaseStaging将失败。我添加了一个assembleReleaseProduction buildType,如下所示:

    buildTypes {
        debug {
          applicationIdSuffix ".debug"
          buildConfigField "String", "CODEPUSH_KEY", "\"\""
        }
        releaseStaging {
          applicationIdSuffix ".staging"
          matchingFallbacks = ['release', 'debug']
          signingConfig signingConfigs.staging
          buildConfigField "String", "CODEPUSH_KEY", "\"wont-give-it\""     

          minifyEnabled enableProguardInReleaseBuilds
          proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 
        }
        releaseProduction {
          matchingFallbacks = ['release']
          signingConfig signingConfigs.release
          buildConfigField "String", "CODEPUSH_KEY", "\"wont-give-it\""

          minifyEnabled enableProguardInReleaseBuilds
          proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
        release {
          signingConfig signingConfigs.release
          buildConfigField "String", "CODEPUSH_KEY", "\"wont-give-it\""

          minifyEnabled enableProguardInReleaseBuilds
          proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

请注意,releaseProduction应该包含matchingFallbacks = ['release']

虽然此方法工作正常,但并不令我满意。为什么assembleReleaseStaging通过而assembleRelease失败?