2
votes

I am programming react native app on Android. Since my app has some third party library, so I must be enable multidex with over 65536 methods on Android.

My android/app/build.gradle

android {
defaultConfig {
    minSdkVersion 16 
    targetSdkVersion 25
    multiDexEnabled true
}}

dependencies {
  compile 'com.android.support:multidex:1.0.3'
}

And I build app successfully. But in my app, I install react-native-fbsdk for login with facebook. There is an error when I have just press login with facebook button:

11-13 20:20:13.707 15581-15640/com.fahasa.android.fahasa E/unknown:ReactNative: Exception in native call
java.lang.RuntimeException: Could not invoke FBGraphRequest.start
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:374)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162)
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
    at android.os.Looper.loop(Looper.java:136)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
    at java.lang.Thread.run(Thread.java:841)
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:363)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162) 
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
    at android.os.Handler.handleCallback(Handler.java:733) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
    at android.os.Looper.loop(Looper.java:136) 
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194) 
    at java.lang.Thread.run(Thread.java:841) 
 Caused by: java.lang.NoSuchMethodError: com.facebook.AccessToken.<init>
    at com.facebook.reactnative.androidsdk.FBGraphRequestModule.setConfig(FBGraphRequestModule.java:158)
    at com.facebook.reactnative.androidsdk.FBGraphRequestModule.buildRequest(FBGraphRequestModule.java:136)
    at com.facebook.reactnative.androidsdk.FBGraphRequestModule.start(FBGraphRequestModule.java:123)
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:515) 
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:363) 
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162) 
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
    at android.os.Handler.handleCallback(Handler.java:733) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
    at android.os.Looper.loop(Looper.java:136) 
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194) 
    at java.lang.Thread.run(Thread.java:841) 

My package.json

"dependencies": {
"async": "^2.5.0",
"bugsnag-react-native": "^2.2.0",
"he": "^1.1.1",
"moment": "^2.18.1",
"oauth-1.0a": "^2.1.0",
"prop-types": "^15.5.10",
"react": "16.0.0-alpha.12",
"react-native": "0.48.3",
"react-native-camera": "^0.13.0",
"react-native-datepicker": "^1.4.7",
"react-native-device-info": "^0.11.0",
"react-native-drawer": "^2.3.0",
"react-native-dropdown-menu": "^2.0.0",
"react-native-fast-image": "^1.0.0",
"react-native-fbsdk": "^0.6.1",
"react-native-firebase": "1.1.2",
"react-native-image-progress": "^1.0.1",
"react-native-keyboard-aware-scroll-view": "^0.2.7",
"react-native-modal-dropdown": "^0.4.2",
"react-native-navbar": "^1.5.0",
"react-native-onesignal": "^3.0.6",
"react-native-progress": "^3.4.0",
"react-native-push-notification": "^2.2.1",
"react-native-root-toast": "^1.0.3",
"react-native-router-flux": "^3.37.0",
"react-native-scrollable-tab-view": "^0.8.0",
"react-native-swiper": "^1.5.12",
"react-native-vector-icons": "^4.0.0",
"react-native-webview-android": "^1.1.17",
"react-navigation": "^1.0.0-beta.11",
"react-redux": "^5.0.3",
"redux": "^3.7.2",
"redux-logger": "^2.6.1",
"redux-persist": "^4.9.1",
"redux-thunk": "^2.1.0"

},

Please help me. Thank you so much!

2

2 Answers

0
votes

Do npm install Build and re run android app either from android studio or npm run android

0
votes

try this version.

implementation 'com.facebook.android:facebook-android-sdk:[4,5)'

In dependencies on your app/build.gradle file.