添加Facebook SDK版本4.26.0后,Android构建失败

时间:2018-09-03 07:26:03

标签: android facebook-android-sdk

在我的应用程序中,我通过下载后将其添加为模块来添加了Facebook SDK版本4.26.0。然后按照Android Studio中的步骤(文件->项目结构->依赖关系->:facebook-android-sdk-4.26.0)将其添加到依赖项中。

然后我按照Sharing on Android

的说明添加以下内容,更新了AndroidManifest.xml文件。
        <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id" />

        <provider android:authorities="com.facebook.app.FacebookContentProvider243722929672425"
        android:name="com.facebook.FacebookContentProvider"
        android:exported="true"/>

我尝试构建项目后,出现以下错误:

Process 'command '/home/juser/software/Sdk/build-tools/26.0.2/aapt'' finished with non-zero exit value 1

Mnanifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hsenid.flipbeats"> <!-- Uses SDk Version -->

 // permissions go here

  <application
    android:name=".util.RootApplication"
    android:allowBackup="true"
    android:backupAgent=".sharedbackup.BlundellBackupAgent"
    android:hardwareAccelerated="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:debuggable="true"
    android:largeHeap="true"
    android:persistent="true"
    android:theme="@style/Theme.Default.RED">
    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id" />

    <provider android:authorities="com.facebook.app.FacebookContentProvider243722429622425"
        android:name="com.facebook.FacebookContentProvider"
        android:exported="true"/>

    <activity
        android:name=".ui.SplashScreenActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppBaseTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

        <data android:scheme="com.beats" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <action android:name="com.beats.VIEW_INTENT" />

            <category android:name="android.intent.category.DEFAULT" />

        </intent-filter>
    </activity>

    // activities comes here

    <meta-data
        android:name="com.google.android.backup.api_key"
        android:value="xxx" />

    <intent-filter>
        <action android:name="com.beats.service.MyPlayer.PLAYLIST_UPDATED" />
    </intent-filter>
    <!-- Services -->
    <service
        android:name=".service.PlayerService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.beats.action.PLAY" />
            <action android:name="com.beats.action.PAUSE" />
            <action android:name="com.beats.action.TOGGLE_PLAYBACK" />
            <action android:name="com.beats.action.NEXT_SONG" />
            <action android:name="com.beats.action.PREVIOUS_SONG" />
            <action android:name="android.intent.action.USER_PRESENT" />
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </service>
    <!-- Application Widget -->
    <receiver
        android:name=".ui.component.Widget"
        android:label="FlipBeats">
        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
        </intent-filter>

        <meta-data
            android:name="android.appwidget.provider"
            android:resource="@xml/widget_info" />
    </receiver>
    <receiver android:name=".service.MediaButtonReceiver">
        <intent-filter>
            <action android:name="android.intent.action.MEDIA_BUTTON" />
            <action android:name="android.media.AUDIO_BECOMING_NOISY" />
            <action android:name="android.intent.action.USER_PRESENT" />
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>
    <receiver
        android:name=".ui.BootCompleted"
        android:enabled="true"
        android:exported="false">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

    <!-- Firebase Service -->
    <service android:name=".firebase.BeatsMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>
    <service android:name=".firebase.BeatsInstanceIDService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>
</application>

Settings.gradle文件:

include ':mobile', ':facebook-android-sdk-4.26.0'

模块的build.gradle文件:

   buildscript {
     repositories {
    maven { url 'https://maven.fabric.io/public' }
   }

      dependencies {
        classpath 'io.fabric.tools:gradle:1.22.1'
      }
   }
 apply plugin: 'com.android.application'
 apply plugin: 'io.fabric'
 apply from: '../config/quality.gradle'
 apply from: '../jacoco.gradle'
 apply plugin: 'sonar-runner'

   android {
    compileSdkVersion 23
    buildToolsVersion "26.0.2"

    defaultConfig {
    applicationId "com.beats"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1001018
    versionName '1.1.18'
    setProperty("archivesBaseName", "beats")

    // Enabling multidex support.
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

   }

    signingConfigs {
    release {
        storeFile file("../keystore/xxx.keystore")
        storePassword "xxx"
        keyAlias "xxx-key"
        keyPassword "xxx"
      }
   }
    buildTypes {

    release {
        testCoverageEnabled = true
        signingConfig signingConfigs.release
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
      }

lintOptions {
    abortOnError false
}

testOptions {
    unitTests.returnDefaultValues = true
}

dexOptions {
    javaMaxHeapSize "2g"
    preDexLibraries = false
    maxProcessCount 4
  }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
    transitive = true;
}

}

apply plugin: 'com.google.gms.google-services'

    repositories {
      maven { url 'https://maven.fabric.io/public' }
  }

该项目的gradle.build文件:

buildscript {
repositories {
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0'
    classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.4.0'
    classpath 'com.google.gms:google-services:3.0.0'
    classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.0.0')
   }
 }

allprojects {
// apply plugin: 'com.jfrog.artifactory'
group 'com.hsenid.flipbeats'
version '1.1.15'

repositories {
    jcenter()
    mavenCentral()
   }
 }

 task clean(type: Delete) {
delete rootProject.buildDir
}

0 个答案:

没有答案