There are many surprises in my work. I met a problem today. After a client’s mobile phone was upgraded to the latest Android 10 system, the original APP of our project would flash back when clicking Icon to start the APP, so it could not be used at all. Gradle/App /build.gradle

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        multiDexEnabled true
        applicationId "com.huaxing.alpha.apps.apollo" // "com.huaxing.alpha.apps.apollo"Official aurora push pack name,//"com.astarup.app"MinSdkVersion 23 targetSdkVersion 27 versionCode 49 versionName5.5.3 ""
        manifestPlaceholders = [
                JPUSH_APPKEY: "d21c04aa23b0050dea5bf85c", / /"d21c04aa23b0050dea5bf85c"// efd166b53c414825b0d3afe7 is the key of the test APP_CHANNEL:"developer-default"
        ]
        ndk {
            abiFilters "armeabi-v7a"."x86"}}Copy the code

After looking through a lot of information, I found that it is not the low Android version of the APP that causes the incompatibility of Android10 phones. I tried to repackage it and actually test it on Android10. The following error occurred during packaging:

Android AAPT: No resource identifier found for attribute 'appComponentFactory' in package 'android'
Copy the code

In the process of resolving this error, we found the data issues: Android /build.gradle: Android /build.gradle: Android /build.gradle: Android /build.gradle:

ext {
    buildToolsVersion = "26.0.3"
    minSdkVersion = 16
    compileSdkVersion = 26
    targetSdkVersion = 26
    supportLibVersion = "26.1.0"/ / add googlePlayServicesVersion googlePlayServicesVersion =16. '+'
}
Copy the code

After repackaging, install real machine test, perfect operation. Further check found that this is because of the react-native device-info dependency in the project. Check the support for AndroidX in the project description. 😀 This module defaults to AndroidX you should configure your library versions similar to This in your android/build.gradle file’s “ext” block

. ext { // dependency versions We have 3 optionsfor deviceId:
    //Option 1 (latest):
    firebaseIidVersion = "19.0.1" // default: "19.0.1"
    //Option 2 (legacy GooglePlay dependency but using AndroidX):
    googlePlayServicesIidVersion = "17.0.0" // default: "17.0.0" - AndroidX
    //Option 3 (legacy GooglePlay dependency before AndroidX):
    googlePlayServicesIidVersion = "16.0.1"


    //include as needed:
    compileSdkVersion = "28" // default: 28 (28 is required for AndroidX)
    targetSdkVersion = "28" // default: 28 (28 is required for AndroidX)
    supportLibVersion = '1.0.2' // Use '28.0.0' or don't specify for old libraries, '1.0.2' or similar for AndroidX mediaCompatVersion = '1.0.1' // Do not specify if using old libraries, specify '1.0.1' or similar for androidx.media:media dependency supportV4Version = '1.0.0' // Do not specify if using old libraries, specify '1.0.0' or similar for androidx.legacy:legacy-support-v4 dependency } ...Copy the code

To sum up, technology continues to evolve and improve. As a developer, there will always be a variety of problems on the way to development. You may feel overwhelmed, but when you face the problem and solve it, you learn and grow. Come on, developers.

Welcome to follow my wechat official account: Jun Wei said.

Jane: Jun Wei said.

My blog: blog.csdn.net/wayne214