Android Material and appcompat Manifest merger failed in react-native or ExpoKit

前端 未结 13 1294
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 16:07

I updated \'android.support:appcompat-v7\' to 28.0.0.

But it brought an error from the build.

Attribute application@appComponentFactory          


        
相关标签:
13条回答
  • 2020-12-15 16:34

    The root cause is related migration to Androidx, google play service updated to androidX Thanks to MR03web This problem belongs to react-native-device-info? best option is to upgrade react-native-device-info using

    yarn upgrade react-native-device-info@2.1.2
    cd android && gradlew clean
    react-native run-android
    

    or if you don't want to upgrade you should exclude com.google.android.gms from react-native-device-info like this. Thanks

    implementation(project(":react-native-device-info"),  {
      exclude group: "com.google.android.gms"
    })
    implementation "com.google.android.gms:play-services-gcm:16.0.0"
    
    0 讨论(0)
  • 2020-12-15 16:36

    I had the same problem, just upgrade react-native-device-info and run the following command

    npm upgrade react-native-device-info@latest
    react-native run-android
    
    0 讨论(0)
  • 2020-12-15 16:38

    Upgrading 'react-native-device-info' to version 2.1.2 fixed the error for me. See github.com/facebook/react-native/issues/25294#issuecomment-503024749

    In short: the library used "services-gcm:+" as a dependency, and the latest gcm version caused this problem.

    0 讨论(0)
  • 2020-12-15 16:38

    According to @Frank's answer the library used services-gcm:+ as a dependency, and the latest gcm version caused this problem.

    And I had used :react-native-admob in my project. So I just change the following lines in android/app/build.gradle

    From:

    implementation project(':react-native-admob')
    

    TO :

    implementation(project(":react-native-admob"),  {
            exclude group: "com.google.android.gms"
    })
    implementation "com.google.android.gms:play-services-ads:16.0.0"
    
    0 讨论(0)
  • 2020-12-15 16:40

    If you are not using react-native-device-info, but have the same error, its probably another library in your project.

    Use this to find the library in question:

    cd your-react-native-project/android
    ./gradlew app:dependencies > deps.txt
    

    Then inspect the deps.txt file for keyword "androidx". Then you can quickly find which native module is using it.

    In my case it was react-native-camera, for which solution above was good but not enough so I had to add this to local.properties:

    firebaseVersion=17.6.0
    googlePlayServicesVersion=16.1.0
    googlePlayServicesVisionVersion=16.2.0
    

    EDIT: After these fixes, running ./gradlew app:dependencies > deps.txt and searching for "androidx" returned no results - this is what we are looking for.

    After running clean on the project, build worked.

    0 讨论(0)
  • 2020-12-15 16:40

    Google play services breaking changes. See Release Notes.

    The simple way to resolve this issue is just changing the version of Google play services.

    Change all com.google.android.gms:play-services-* dependencies to version 16

    0 讨论(0)
提交回复
热议问题