React-native-fbsdk问题:AAPT,任务执行失败':app:processDebugResources'

问题描述 投票:0回答:1

当我在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(app)

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的失败(它要求版本27.0.2 android studio还没有它

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

android reactjs react-native fbsdk react-native-fbsdk
1个回答
0
投票

首先,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中的platform-tools和JAVA sdk路径。

© www.soinside.com 2019 - 2024. All rights reserved.