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

前端 未结 13 1292
佛祖请我去吃肉
佛祖请我去吃肉 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:18

    This answer should help most people. If it still does not then the way to solve this (which is not that good) is that you open the android project in android studio. That should fetch all the gradle files. On the right side the view should be android.

    From here just check each gradle build file for a + sign ahead of google play services or firebase services or any such library. This has also been explained in this answer.

    After which you either change it like explained in the answer above. like so.

    implementation(project(":react-native-admob"),  {
            exclude group: "com.google.android.gms"
    })
    implementation "com.google.android.gms:play-services-ads:16.0.0"
    

    Or you provide a variable if the library is using one or as a last resort change it there itself.

    The reason I put it here is so that any newbie who is sick of this error which randomly appeared out of nowhere all of a sudden can solve it effectively and not...die. lol.

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

    Upgrading react-native-device-info to version 2.1.2 Fix my problem

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

    Add the following to your gradle.properties then clean/rebuild

    googlePlayServicesVersion=16.1.0
    firebaseVersion=17.6.0
    
    0 讨论(0)
  • 2020-12-15 16:26

    I found a solution through my search by referring to @MehulSolanki answer.

    I add

    tools:replace="android:appComponentFactory"
    android:appComponentFactory="whateverString"
    

    in my on AndroidManifest.xml

    and update com.android.tools.build:gradl:

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
      }
    

    And add this in your gradle.properties file

    android.useAndroidX=true
    android.enableJetifier=true
    

    ERROR: [TAG] Failed to resolve variable '${animal.sniffer.version}'

    ERROR: [TAG] Failed to resolve variable '${junit.version}'

    In case of above error

    1. File -> Invalidate Caches / restart
    2. Build -> Clean project

    error: package android.support.annotation does not exist error: cannot find symbol class Nullable

    In case of above error

    Add implementation 'androidx.annotation:annotation:1.1.0'

    change import android.support.annotation.Nullable; => androidx.annotation.Nullable;

    change import android.support.annotation.NonNull; => androidx.annotation.NonNull;

    Compile version and target version should be 28.

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

    Add 'tools:replace="android:appComponentFactory"' in your AndroidManifest.xml inside <application> tag

    Your AndroidManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        package="ru.chopcode.myapplication">
    
        <application
            tools:replace="android:appComponentFactory"
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
       </application>
    

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

    Downgrade Google Play service version. In android/app/build.gradle change

    compile 'com.google.android.gms:play-services-<service_name>:+'

    to

    compile 'com.google.android.gms:play-services-<service_name>:16.0.0'

    So in my case < sevice_name > was location. But in someone's else case it may be any other Google Play Service (like in list here http://www.androiddocs.com/google/play-services/setup.html).

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