1

反応ネイティブのアプリがあり、FB Android SDKとFB Audience Network SDKを仲介アダプタでインポートしようとしています。Facebook Android SDKおよびFacebook Audience Network SDKでコンパイルできません

私のapp/build.gradleにこれらの依存関係を追加すると、ビルド中に次のエラーが発生します。

compile 'com.facebook.android:facebook-android-sdk:4.22.1' 
compile 'com.facebook.android:audience-network-sdk:4.26.1' 
compile 'com.google.ads.mediation:facebook:4.26.1.0' 

エラー:

C:\ig3\android\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. 

C:\ig3\android\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. 

C:\ig3\android\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. 

C:\ig3\android\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. 

私は私のプロジェクトをコンパイルするために得ることができる唯一の方法は、Android/build.gradleでこれを行うことでした。

allprojects { 
    .... 
    configurations.all { 
     resolutionStrategy { 
     eachDependency { DependencyResolveDetails details -> 
      if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') { 
      details.useVersion "0.49.5" // Your real React Native version here 
      } 
     } 
     force 'com.facebook.android:facebook-android-sdk:4.22.1' <---Add this line 
     force 'com.facebook.android:audience-network-sdk:4.26.1' <---Add this line 
     } 
    } 
} 

そして、これらの2行をコメントアウトandroid/app/build.gradle:

//compile 'com.facebook.android:facebook-android-sdk:4.22.1' 
//compile 'com.facebook.android:audience-network-sdk:4.26.1' 
compile 'com.google.ads.mediation:facebook:4.26.1.0' 

アンドロイド/ build.gradleで他のバージョンのFB Android SDKを試しても、私は以前に述べたのと同じエラーが出ます。いくつかの調査の後、私はcom.android.support:appcompatのバージョンを変更しようとしましたが、私が23を使用しないと、上記と同じエラーが表示されます。

これは、それはハックのように感じる、私はなぜ私はアンドロイド/アプリ/ build.gradleにSDKを含めることができなかった、私は永遠にFBのアンドロイドSDKバージョン4.22.1で立ち往生したくないのか分からない。

また、テスト後は、広告オーディエンスネットワークのAdmobから広告メディエーションが機能しているようには見えませんが、上記のようなsdkや関連のない問題が原因であるかどうかはわかりません。

誰かが私に正しく表示される方法があれば、私はそれを感謝します。ありがとう!

EDIT: 全アンドロイド/ build.gradle

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 
    classpath 'com.google.gms:google-services:3.0.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     mavenLocal() 
     jcenter() 
     mavenCentral() 
     maven { url "https://jitpack.io" } 
     maven { url 'https://maven.google.com' } 
     maven { 
      // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 
      url "$rootDir/../node_modules/react-native/android" 
     } 
    } 
    configurations.all { 
     resolutionStrategy { 
     eachDependency { DependencyResolveDetails details -> 
      if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') { 
      details.useVersion "0.49.5" // Your real React Native version here 
      } 
     } 
     force 'com.facebook.android:facebook-android-sdk:4.22.1' 
     force 'com.facebook.android:audience-network-sdk:4.26.1' 
     } 
    } 
} 

とAndroid /アプリ/ build.gradleいっぱい:

android { 
    compileSdkVersion 23 
    buildToolsVersion '25.0.2' 

    defaultConfig { 
     applicationId "com.myapp" 
     minSdkVersion 16 
     targetSdkVersion 22 
     versionCode 50 
     versionName "1.11.11" 
     ndk { 
      abiFilters "armeabi-v7a", "x86" 
     } 
     multiDexEnabled true 
    } 
    dexOptions { 
     jumboMode = true 
     javaMaxHeapSize "4g" 
    } 
    signingConfigs { 
     release { 
      .... 
     } 
    } 
    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" 
      signingConfig signingConfigs.release 
     } 
    } 
    // 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 
      } 
     } 
    } 
} 

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile "com.facebook.react:react-native:+" // From node_modules 
    compile 'com.android.support:appcompat-v7:23+' 

    compile project(':react-native-fetch-blob') 
    compile 'com.android.support:multidex:1.0.1' 
    compile project(':react-native-billing') 
    compile project(':bugsnag-react-native') 
    compile project(':react-native-admob') 
    compile fileTree(dir: "libs", include: ["*.jar"]) 

    compile project(':react-native-fbsdk') 
    compile project(':react-native-code-push') 
    compile project(':react-native-device-info') 
    compile project(':react-native-config') 
    compile project(':react-native-fast-image') 
    compile project(':react-native-camera') 
    compile project(':react-native-google-analytics-bridge') 
    compile project(':react-native-vector-icons') 

    compile(project(":react-native-google-signin")) { 
     exclude group: "com.google.android.gms" // very important 
    } 

    compile 'com.google.android.gms:play-services-auth:11.6.0' 
    compile 'com.google.firebase:firebase-appindexing:11.6.0' 

    compile 'com.facebook.android:facebook-android-sdk:4.22.1' 
    compile 'com.facebook.android:audience-network-sdk:4.26.1' 
    compile 'com.google.ads.mediation:facebook:4.26.1.0' 

} 

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

これはあなたが探しているものではないかもしれませんが、今日は 'comile.android.gms 'を使って問題が発生しました:play-services-auth:11.6.0''と' compile' com.facebook .android:facebook-android-sdk:4.22.1''で、play-services-authを削除すると何かが起きたかどうかを確認してください。 –

+0

@H.Brooks play-services-authを削除しても効果はありません。私がcom.facebook.android:audience-network-sdk:4.26.1 'を 'compile'して削除した場合、私のアプリは(上記のアンドロイド/ app/build.gradleから)ビルドされます。しかし、これは私が必要とするものです。何か案は? –

+0

私はあなたに戻って確認してみましょう。 –

答えて

0

私のソリューションは、これらすべてを更新することでした:

gradle to 3.01 
gradle wrapper to 4.1 
compilesdkversion to 26 
buildtoolsversion to 26.02 
com.android.support:appcompat-v7 to 26+ 
com.facebook.android:facebook-android-sdk:4.28.0 

と私のアプリは正常に構築されます

関連する問題