【问题标题】:React-native-fbsdk issue : AAPT, Execution failed for task ':app:processDebugResources'React-native-fbsdk 问题:AAPT,任务“:app:processDebugResources”执行失败
【发布时间】:2018-04-20 02:22:12
【问题描述】:

当我在 react-native 上运行我的应用时:我收到了这条消息。

\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'.

\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'.

\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'.

\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

这是我的 Build Gradle(应用程序)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"

    defaultConfig {
        applicationId "com.example.elviragraciela.prueban"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories{
    mavenCentral()
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:25.3.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.facebook.android:facebook-android-sdk:4.28.0'

}

这也是我的构建 Gradle(项目)

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

此外,还有 Build Gradle (react-native-fbsdk)

apply plugin: 'com.android.library'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 26
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.facebook.android:facebook-android-sdk:4.28.0'
    compile 'com.facebook.react:react-native:+' // support react-native-v0.22-rc+

}

我在 Windows 上运行这个项目,我尝试了几次将 facebook-android-sdk 从 4.28 更改为更新版本,但这会导致 com.android.support:appcompat-v7 27.0.2 失败(它要求android studio还没有的27.0.2版本

我也将 compileSdkVersion 和 buildToolsVersion 更改为更新的版本,但这还没有奏效。

【问题讨论】:

  • 你是否降低了sdk版本?
  • facebook-android-sdk 版本?是的,我做到了。任何高于 4.28.0 的版本都不适合我(因为 appcompat-v7 27.0.2
  • 尝试创建一个初始SDK版本为26的新项目。再次降级将再次导致同样的问题。

标签: android reactjs react-native fbsdk react-native-fbsdk


【解决方案1】:

首先 AAPT 是 Android 资产打包工具,关于如何命名资产有一些规则。例如,如果我记得很清楚,您不能在名称中使用大写字母(pictureNew.png 使用 picturenew.png)。

然后尝试升级sdk,我现在正在使用这个:

 compileSdkVersion 26
 buildToolsVersion "26.0.2"

和:

 compile "com.android.support:appcompat-v7:26.0.2"
 compile "com.facebook.android:facebook-android-sdk:[4.22.1)"

并检查您的路径中是否包含来自您的 android SDK 的平台工具和 JAVA sdk 路径。

【讨论】:

  • 感谢您的建议。我将 facebook-android-sdk 更改为 [4.22.1),但它不起作用。无法解析配置 ':react-native-fbsdk:_debugPublishCopy' 的所有依赖项。 > 找不到 com.facebook.android:facebook-android-sdk:[4.22.1)。如何检查 java sdk 路径?
  • 我有 react-native-fbsdk v0.70
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-05-05
  • 1970-01-01
  • 2018-12-18
  • 2019-11-02
  • 2015-08-27
  • 2021-04-28
  • 2023-04-08
相关资源
最近更新 更多