5

清单合并失败:属性 meta-data#android.support.VERSION@value value=(26.0.1) from [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31 也是存在于 [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0)。建议:将 'tools:replace="android:value"' 添加到 AndroidManifest.xml:26:9-28:38 的元素以覆盖。

注册护士 v0.55

反应原生设备信息 v0.21.5

应用程序/build.gradle:

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
}
dependencies {
    compile project(':react-native-device-info')
    compile project(':react-native-splash-screen')
    compile(project(":react-native-google-sign-in")) { //ForGoogleSignIn
        exclude group: "com.google.android.gms"
    }
    compile project(':react-native-fbsdk-corrected')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:26.0.1"
   compile "com.facebook.android:facebook-android-sdk:4.28.0"
    compile "com.facebook.react:react-native:+"  
    compile "com.google.android.gms:play-services-auth:11.8.0" 
}

安卓菜单:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.myapp" xmlns:tools="http://schemas.android.com/tools"
>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="true"
      android:theme="@style/AppTheme">
       <activity
        android:name=".SplashActivity"
        android:theme="@style/SplashTheme"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
       <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

    </application>
</manifest>

反应原生设备信息/android/build.gradle

apply plugin: 'com.android.library'

def DEFAULT_COMPILE_SDK_VERSION             = 23
def DEFAULT_BUILD_TOOLS_VERSION             = "25.0.2"
def DEFAULT_TARGET_SDK_VERSION              = 22
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION    = "+"

android {
    compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
    buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
        versionCode 2
        versionName "1.1"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    lintOptions {
       warning 'InvalidPackage'
    }
}

dependencies {
    def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION

    compile 'com.facebook.react:react-native:+'
    compile "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
}
4

1 回答 1

4

检查build.gradle依赖react-native-xxxx模块并将依赖gmsfirebase库的版本更改为相同。

gms依赖于您的库的版本app是当前11.8.0,因此将其他所有内容更改为11.8.0.

检查所有模块以查看 和 的gms版本firebase

在某些情况下,您可能需要更改react-native-device-info模块的 sdk 版本。既然有这么多情况,先把我的设置写下来。

应用程序/build.gradle:

dependencies {
    // ...
    // gms version is 11.8.0
    compile "com.google.android.gms:play-services-auth:11.8.0" 
}

react-native-device-info/build.gradle: (这是我的设置..)

buildscript {
    // set up the same version
    ext.firebaseVersion = '11.8.0'
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 2
        versionName "1.1"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    lintOptions {
        abortOnError false
        warning 'InvalidPackage'
    }
}

dependencies {
    compile 'com.facebook.react:react-native:+'
    compile "com.google.android.gms:play-services-gcm:$firebaseVersion"
    compile "com.google.firebase:firebase-core:$firebaseVersion"
    compile "com.google.firebase:firebase-config:$firebaseVersion"
    compile "com.google.firebase:firebase-auth:$firebaseVersion"
    compile "com.google.firebase:firebase-database:$firebaseVersion"
    compile "com.google.firebase:firebase-storage:$firebaseVersion"
    compile "com.google.firebase:firebase-messaging:$firebaseVersion"
    compile "com.google.firebase:firebase-crash:$firebaseVersion"
    compile "com.google.firebase:firebase-perf:$firebaseVersion"
    compile "com.google.firebase:firebase-ads:$firebaseVersion"
    compile "com.google.firebase:firebase-firestore:$firebaseVersion"
    compile "com.google.firebase:firebase-invites:$firebaseVersion"
}
于 2018-05-24T08:52:26.833 回答