android - java.lang.NoSuchMethodError : No virtual method setSkipClientToken(Z)V in class Lcom/facebook/GraphRequest;

标签 android react-native gradle build.gradle nosuchmethoderror

在我什么都没做之前它工作正常,没有包更新,没有 gradle 更新,没有任何东西刚刚创建了新的构建,并且发生了这个错误。 但对于某些团队成员来说,错误发生在 gradle 同步之后。
问题是构建成功生成没有任何错误但是当打开应用程序时它突然崩溃(在调试和 Release模式下)
错误

    E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
        java.lang.NoSuchMethodError: No virtual method setSkipClientToken(Z)V in class Lcom/facebook/GraphRequest; or its super classes (declaration of 'com.facebook.GraphRequest' appears in /data/app/~~aLf3pfLySq5u7zpIAr2Hlg==/com.package-name-99h4GcP3GNx2sMs76AXGvA==/base.apk)
            at com.facebook.marketing.internal.RemoteConfigManager.getRemoteConfigQueryResponse(RemoteConfigManager.java:87)
            at com.facebook.marketing.internal.RemoteConfigManager.access$000(RemoteConfigManager.java:43)
            at com.facebook.marketing.internal.RemoteConfigManager$1.run(RemoteConfigManager.java:64)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
            at java.lang.Thread.run(Thread.java:923)
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
  ext {
      buildToolsVersion = "30.0.2"
      minSdkVersion = 21
      compileSdkVersion = 30
      targetSdkVersion = 30
      ndkVersion = "21.4.7075529"
  }
  repositories {
      google()
      mavenCentral()
      jcenter()
      // maven {
      //    url 'https://maven.fabric.io/public'
      // }
      maven { url "https://www.jitpack.io" }
  }
  dependencies {
      classpath("com.android.tools.build:gradle:4.2.2")
      classpath 'com.google.gms:google-services:4.2.0'  // Google Services plugin
      // Add the Fabric Crashlytics plugin.
      // classpath 'io.fabric.tools:gradle:1.31.2'
      // firebase performance sdk
      classpath 'com.google.firebase:perf-plugin:1.4.0'
      classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'


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

allprojects {
  repositories {
      mavenCentral()
      mavenLocal()
      maven {
          // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
          url("$rootDir/../node_modules/react-native/android")
      }
      maven {
          // Android JSC is installed from npm
          url("$rootDir/../node_modules/jsc-android/dist")
      }

      google()
      jcenter()
      maven { url 'https://www.jitpack.io' }
  }
}


subprojects {
  afterEvaluate {project ->
      if (project.hasProperty("android")) {
          android {
              buildToolsVersion "28.0.3"
              compileSdkVersion 28
          }
      }
  }
}

subprojects {
  afterEvaluate {project ->
      if (project.hasProperty("android")) {
          android {
              compileSdkVersion 29
              buildToolsVersion '29.0.3'
          }
      }
  }
}
packages
"dependencies": {
  "@eva-design/eva": "^2.1.0",
  "@react-native-async-storage/async-storage": "^1.15.14",
  "@react-native-community/blur": "^3.6.0",
  "@react-native-community/checkbox": "^0.5.0",
  "@react-native-community/netinfo": "^6.0.1",
  "@react-native-community/toolbar-android": "^0.1.0-rc.2",
  "@react-native-firebase/analytics": "^10.3.1",
  "@react-native-firebase/app": "^10.3.0",
  "@react-native-firebase/auth": "^10.3.1",
  "@react-native-firebase/crashlytics": "^10.3.1",
  "@react-native-firebase/dynamic-links": "^10.3.1",
  "@react-native-firebase/firestore": "^10.3.1",
  "@react-native-firebase/iid": "^10.3.1",
  "@react-native-firebase/in-app-messaging": "^10.3.1",
  "@react-native-firebase/messaging": "^10.3.1",
  "@react-native-firebase/perf": "^10.3.1",
  "@react-native-firebase/remote-config": "^10.3.1",
  "@react-native-firebase/storage": "^10.3.1",
  "@react-native-picker/picker": "^2.1.0",
  "@react-navigation/bottom-tabs": "^6.0.9",
  "@react-navigation/native": "^6.0.6",
  "@react-navigation/stack": "^6.0.11",
  "@types/react-native": "^0.65.5",
  "@ui-kitten/components": "^5.1.0",
  "axios": "^0.19.0",
  "i18n-js": "^3.5.1",
  "moment": "^2.24.0",
  "native-base": "2.13.8",
  "react": "17.0.2",
  "react-content-loader": "^4.3.4",
  "react-native": "0.66.0",
  "react-native-actions-sheet": "^0.5.6",
  "react-native-adjust": "^4.28.0",
  "react-native-amplitude-analytics": "^0.2.7",
  "react-native-animatable": "^1.3.3",
  "react-native-code-push": "^7.0.4",
  "react-native-config": "^1.3.3",
  "react-native-contacts": "^5.0.7",
  "react-native-dots-pagination": "^0.2.0",
  "react-native-fbsdk-next": "^6.2.0",
  "react-native-fingerprint-scanner": "^6.0.0",
  "react-native-floating-action": "^1.22.0",
  "react-native-geocoding": "^0.4.0",
  "react-native-geolocation-service": "^5.2.0",
  "react-native-gesture-handler": "^1.5.2",
  "react-native-get-random-values": "^1.4.0",
  "react-native-html-to-pdf-lite": "^0.11.0",
  "react-native-image-base64": "^0.1.4",
  "react-native-image-pan-zoom": "^2.1.11",
  "react-native-image-picker": "^4.1.2",
  "react-native-image-resizer": "^1.2.0",
  "react-native-in-app-review": "^2.1.7",
  "react-native-linear-gradient": "^2.5.6",
  "react-native-loading-spinner-overlay": "^1.1.0",
  "react-native-material-menu": "^1.0.0",
  "react-native-material-textfield": "^0.16.1",
  "react-native-modal": "^13.0.0",
  "react-native-phone-call": "^1.0.9",
  "react-native-ratings": "^7.3.0",
  "react-native-reanimated": "^1.13.0",
  "react-native-safe-area-context": "^3.3.2",
  "react-native-screens": "^3.9.0",
  "react-native-share": "^7.2.1",
  "react-native-smooth-pincode-input": "^1.0.9",
  "react-native-sms-retriever": "https://github.com/sarmad1995/react-native-sms-retriever.git",
  "react-native-snap-carousel": "^3.9.1",
  "react-native-splash-screen": "^3.2.0",
  "react-native-svg": "^12.1.1",
  "react-native-version-check": "^3.4.2",
  "react-native-version-number": "^0.3.6",
  "react-native-view-shot": "^3.1.2",
  "react-native-walkthrough-tooltip": "^1.3.0",
  "react-redux": "^7.1.3",
  "redux": "^4.0.4",
  "redux-logger": "^3.0.6",
  "redux-persist": "^6.0.0",
  "redux-thunk": "^2.3.0",
  "rn-fetch-blob": "^0.12.0",
  "urbanairship-react-native": "^12.0.0",
  "uuid": "^8.3.0"
},

最佳答案

我们已经通过替换解决了这个问题

implementation 'com.facebook.android:facebook-marketing:[4,5)'
经过
implementation 'com.facebook.android:facebook-marketing:latest.release'
android/app/build.gradle文件。
发布此内容,以便面临相同问题的人可以轻松找到解决方案。我和我的团队花了大约一天半的时间才弄清楚,因为那里没有明确的解决方案。
解决方案引用:here

关于android - java.lang.NoSuchMethodError : No virtual method setSkipClientToken(Z)V in class Lcom/facebook/GraphRequest;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71256006/

相关文章:

react-native - 在React Native Android应用中创建Web Worker

reactjs - 为什么组件中的 React Native 函数没有 "function"关键字?

javascript - Postman 中的 API 工作正常但在 React Native 中出现 422 错误

gradle - 创建具有不同配置值的任务的副本

gradle - 将 Kotlin 的 detekt 版本定义为额外属性(ext)

gradle - 如何强制 gradle 重新下载依赖项?

android - 强制应用程序从第一个 Activity 重新启动(当权限被拒绝时)

java - 可以在警报对话框上放置一个微调器吗?

android - QML 中的 SVG 未在 Android 上显示

java - 加密应用程序数据的正确方法