更新Android Studio后,使用react-native-FBSDK编译应用程序时出错

时间:2018-05-07 03:24:20

标签: react-native react-native-fbsdk

我正确使用react-native-FBSDK,但是在将Android Studio更新到版本3之后,我收到此错误:

  

无法解析符号' CallbackManager'

这是我的MainApplication.java

package com.app.dhsriwvboakzzsyqvpjbdxtqmjrlegfclywhtmcgp;

import android.app.Application;

import com.facebook.react.ReactApplication;
import com.sbugert.rnadmob.RNAdMobPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.facebook.CallbackManager;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.FacebookSdk;

import java.util.Arrays;

public class MainApplication extends Application implements ReactApplication {

private static CallbackManager mCallbackManager = CallbackManager.Factory.create();

protected static CallbackManager getCallbackManager() {
return mCallbackManager;
}

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
  return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
    new MainReactPackage(),
    new RNAdMobPackage(),
    new VectorIconsPackage(),
    new FBSDKPackage(mCallbackManager)
  );
}

@Override
protected String getJSMainModuleName() {
  return "index";
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}

@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}

我看到问题Cannot resolve symbol callbackManager facebook sdk 4.0's lib,但我无法解决我的问题,因为我是Android开发的新手。

0 个答案:

没有答案