首页 > 解决方案 > React Native 应用程序的先前工作(已部署版本)无法构建的可能原因有哪些?

问题描述

大约 2 个月前,我部署了一个 React Native 应用程序的工作版本。最近,我遇到了我正在开发的当前版本的问题,该版本不允许我在没有收到的情况下进行构建

AAPT:错误:找不到资源 android:attr/dialogCornerRadius

AAPT:错误:找不到资源 android:attr/fontVariationSettings。

AAPT:错误:找不到资源 android:attr/ttcIndex。

错误:链接引用失败。
命令:/Users/someguy/.gradle/caches/transforms-1/files-1.1/aapt2-3.5.0-alpha03-5252756-osx.jar/d3ea99fc2d1356bcc9bc022a544dfd8b/aapt2-3.5.0-alpha03-5252756-osx/aapt2 链接-I\ /Users/someguy/Library/Android/sdk/platforms/android-26/android.jar\ --manifest\ /Users/someguy/projects/third/some-app/android/app/build/intermediates/merged_manifests /debug/processDebugManifest/merged/AndroidManifest.xml\ -o\ /Users/someguy/projects/third/some-app/android/app/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\ - R\@/Users/someguy/projects/third/some-app/android/app/build/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_。txt\ --auto-add-overlay\ --java\ /Users/someguy/projects/third/some-app/android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\ --proguard-main-dex \ /Users/someguy/projects/third/some-app/android/app/build/intermediates/legacy_multidex_aapt_derived_proguard_rules/debug/processDebugResources/manifest_keep.txt\ --custom-package\ com.someapp\ -0\ apk\ --output -text-symbols\ /Users/someguy/projects/third/some-app/android/app/build/intermediates/symbols/debug/R.txt\ --no-version-vectors 守护进程:AAPT2 aapt2-3.5.0- alpha03-5252756-osx 守护进程 #00-alpha03-5252756-osx 守护进程#00-alpha03-5252756-osx 守护进程#00-alpha03-5252756-osx 守护进程#00-alpha03-5252756-osx 守护进程#00-alpha03-5252756-osx 守护进程#00-alpha03-5252756-osx 守护进程#0

我无法解决这个问题,所以我决定回去尝试在物理设备上构建之前发布的版本。当我尝试构建该版本时,我收到了完全相同的错误消息!?!?!

我相信问题出在 build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile


def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.Someapp"
        minSdkVersion 19
        targetSdkVersion 26
        multiDexEnabled true
        versionCode 34
        versionName "1.3.4"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        packagingOptions {
            exclude "lib/arm64-v8a/libgnustl_shared.so"
        }
        externalNativeBuild {
            cmake {
                arguments '-DANDROID_STL=c++_static'
            }
        }
    }
    signingConfigs {
        release {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
    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"
            signingConfig signingConfigs.release
        }

        debug {
            debuggable true
        }
    }
    // 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
            }
        }
    }
    externalNativeBuild {
        cmake {
            path 'CMakeLists.txt'
        }
    }
    dexOptions {
        jumboMode true
    }
}

dependencies {
    implementation project(':react-native-i18n')
    implementation project(':react-native-svg')
    implementation project(':react-native-extra-dimensions-android')
    implementation project(':react-native-google-analytics-bridge')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-spinkit')
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-picker')
    implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.facebook.react:react-native:+'
    // From node_modules
    implementation 'com.facebook.fresco:fresco:1.3.0'
    implementation 'com.facebook.fresco:animated-gif:1.3.0'
    implementation project(':blelibrary')
    implementation project(':gaialibrary')
    implementation project(':vmupgradelibrary')
    implementation 'com.google.code.gson:gson:2.8.4'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation project(':react-native-connectivity-status')

    implementation("com.google.android.gms:play-services-basement:15.0.1")
    implementation("com.google.android.gms:play-services-base:15.0.1")
    implementation 'com.android.support:multidex:1.0.3'
}

// 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'
}

repositories {
}

buildscript {
    repositories {
        maven { url 'https://github.com/500px/500px-android-blur/raw/master/releases/' }
    }
    dependencies {
    }
}
// apply plugin: 'com.google.gms.google-services'

我能够让应用程序的新版本工作,但只有在我将compiledSdkVersion 迁移/更新到28 之后......这提出了它自己的一系列问题:我无法再让调试器工作。另外,我更愿意保留旧版本的应用程序。

这让我相信这个问题与 react-native 代码无关,而是我在不知不觉中对我的系统进行的更改。

应用程序的 iOS 版本构建没有问题,所以这严格来说是 Android 版本问题。

标签: androidreact-nativereact-native-android

解决方案


推荐阅读