首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >React Native,Android:找不到与给定名称'android:TextAppearance.Material.Widget.Button.Borderless.Colored‘匹配的资源

React Native,Android:找不到与给定名称'android:TextAppearance.Material.Widget.Button.Borderless.Colored‘匹配的资源
EN

Stack Overflow用户
提问于 2017-06-24 06:21:39
回答 1查看 1.5K关注 0票数 3

我正在使用React Native 0.43.4构建一个安卓应用程序。

运行react-native run-android后,我得到以下错误:

代码语言:javascript
复制
/Applications/MAMP/htdocs/myapp/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

/Applications/MAMP/htdocs/myapp/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

/Applications/MAMP/htdocs/myapp/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

/Applications/MAMP/htdocs/myapp/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.


:app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

我看到过一个类似的问题,是由于编译SDK版本与构建工具版本不匹配而导致的:

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'

但是,如果您查看我的build.gradle,您将看到它们确实匹配:

代码语言:javascript
复制
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-navigation')
    compile project(':react-native-fs')
    compile project(':react-native-camera')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

最后,我已经使用Android studio安装了Android SDK。当我键入android list target时,我得到以下内容:

代码语言:javascript
复制
Available Android targets:
----------
id: 1 or "Google Inc.:Google APIs:23"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 1
     Description: Google APIs
     Based on Android 6.0 (API level 23)
     Libraries:
      * com.google.android.maps (maps.jar)
          API for Google Maps
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
----------
id: 2 or "android-23"
     Name: Android API 23
     Type: Platform
     API level: 23
     Revision: 3
----------
id: 3 or "android-24"
     Name: Android API 24
     Type: Platform
     API level: 24
     Revision: 2
----------
id: 4 or "android-25"
     Name: Android API 25
     Type: Platform
     API level: 25
     Revision: 3
----------
id: 5 or "android-26"
     Name: Android API 26
     Type: Platform
     API level: 26
     Revision: 1

我希望我能得到任何帮助!

EN

回答 1

Stack Overflow用户

发布于 2017-07-22 10:18:06

我也有同样的问题。

如果您确实使用了react-native-fbsdk,请在此处检查问题和答案:Facebook Sdk Android Error Building

对我来说,我只需将/android/app/build.gradle中的compileSdkVersion和buildToolsVersion改成25和25.0.1就解决了这个问题。

代码语言:javascript
复制
compileSdkVersion 25
buildToolsVersion “25.0.1”
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44730686

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档