清单合并失败。添加并链接了react-native-splash-screen后

时间:2018-07-25 07:29:16

标签: android react-native build.gradle

任务':app:processDebugManifest'的执行失败。>清单合并失败:[com.android.support:cardview中的属性元数据#android.support.VERSION@value value =(26.0.1) -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 )。 建议:在AndroidManifest.xml:26:9-28:38的元素上添加'tools:replace =“ android:value”'以进行覆盖。

RN v0.55.4

本机启动屏幕v3.0.6

app / 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"
        }
    }
      signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                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"
        }
    }
    // 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
            }
        }
    }
}

dependencies { 
    compile project(':react-native-audio')
    compile project(':react-native-track-player')
    compile project(':react-native-background-job')
    compile project(':react-native-push-notification')
    compile project(':react-native-notifications')
    compile project(':react-native-fetch-blob')
    compile project(':react-native-image-picker')
    compile project(':react-native-restart')
    compile project(':react-native-device-info')
    compile project(':react-native-splash-screen')
    compile project(':react-native-vector-icons')
    compile project(':react-native-fbsdk-corrected')
    compile(project(':react-native-google-sign-in')) { //ForGoogleSignIn
        exclude group: "com.google.android.gms"
    }

    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"//Added
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile "com.google.android.gms:play-services-auth:11.8.0" //ForGoogleSignIn

}
apply plugin: "com.google.gms.google-services" ///ForGoogleSignIn

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

AndroidMenifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.happycow" 
    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.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <permission android:name="com.myapp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <uses-permission android:name="com.myapp.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

    <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">
            <intent-filter >
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <!-- Accepts URIs that begin with "https://www.happycow.com/post” -->
                <data android:scheme="https" android:host="www.myapp.com" android:pathPrefix="/post" />
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
        <provider android:authorities="com.facebook.app.FacebookContentProvider219275678834893" android:name="com.facebook.FacebookContentProvider" android:exported="true" />
        <receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="com.myapp" />
            </intent-filter>
        </receiver>

        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
        <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService" android:exported="false">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>

    </application>

</manifest>

react-native-splash-screen / android / build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile "com.facebook.react:react-native:+"  // From node_modules
}

1 个答案:

答案 0 :(得分:0)

我发现,在我的项目中,第三方模块都使用com.google.android.gms:play-services的其他版本。因此,在每个第三方模块中,我都使用相同版本的com.google.android.gms:play-services。我的项目具有11.8.0版本,因此我对第三方模块com.google.android.gms:play-services都使用了相同版本。

无需更改额外的工作,只需将模块的google-services版本更改为与我的项目google-services版本相同。