I addedd ReactNative Facebook SDK. It works great on iOS but on Android it gives me this error when building.
package com.friendster;
import android.app.Application;
import android.util.Log;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
Gives me this error:
:app:compileDebugJavaWithJavac
/development/reactnative/FriendsterProject/Friendster-App/android/app/src/main/java/com/friendster/MainApplication.java:20: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
1 error
:app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
Thanks in advance
@facebook-github-bot stack-overflow
Hey @theobouwman and thanks for posting this! @damusnet tells me this issue looks like a question that would be best asked on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. Will close this as this is really a question that should be asked on SO.
Did you import com.friendster.BuildConfig; in your MainApplication.java?
@damusnet I did but still there is same error
The same problem, any solution?
@pk-developer @Luckygirlllll
you have probably renamed your package name and there's a file which is addressing your old package name, check your MainApplication.java and MainActivity.java package name and their root folder name to be the same, finally use react-native upgrade command in the root folder of your project and it will probably solve the issue.
@reza7rm Thank dude ..!
Most helpful comment
@pk-developer @Luckygirlllll
you have probably renamed your package name and there's a file which is addressing your old package name, check your MainApplication.java and MainActivity.java package name and their root folder name to be the same, finally use react-native upgrade command in the root folder of your project and it will probably solve the issue.