Description
I'm trying to install react-native-fbsdk in my react-native project.
I'm doing it with these commends:
react-native init myapp
cd myapp
npm i -S react-native-fbsdk // react-native install react-native-fbsdk is not a valid commend
react-native link react-native-fbsdk
Then I'm trying to build with this commend:
react-native run-android
Then I went through the whole installation process of "importing and overriding" which explained here:
https://github.com/facebook/react-native-fbsdk
Then I got this error during the building process:
Loading dependency graph, done.
ERROR EPERM: operation not permitted, lstat 'C:\wamp\www\myapp\app\android\ap
p\build\intermediates\incremental\mergeDebugResources\merged.dir\values'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"C:\\wamp\\www\\myapp\\a
pp\\android\\app\\build\\intermediates\\incremental\\mergeDebugResources\\merged
.dir\\values"}
Error: EPERM: operation not permitted, lstat 'C:\wamp\www\myapp\app\android\app
\build\intermediates\incremental\mergeDebugResources\merged.dir\values'
at Error (native)
See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
Press any key to continue . . .
I went through the steps few times with few new projects and it always happen. Moreover the doc looks a bit not updated.
Any help please in order to complete the build process without any errors?
Thanks.
Hey @hramos
Can you advice? I spoke with fackbook supports and they direct me to react-native page.
My node version is 6.10.1
npm 3.10.10
react-native-cli 2.0.1
It looks like your description is missing some necessary information. Can you please add all the details specified in the template? This is necessary for people to be able to understand and reproduce the issue being reported.
@hramos You are totally right! Sorry for that!
I edited my question and now I hope it is ok, if no please let me know what is missing.
Thank you in advance
@hramos These are my files:
MainActivity.java
package com.app;
import com.facebook.react.ReactActivity;
import android.content.Intent;
public class MainActivity extends ReactActivity {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
}
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "app";
}
}
MainApplication.java
package com.app;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.CallbackManager;
import com.facebook.FacebookSdk;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
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 FBSDKPackage(mCallbackManager)
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(getApplicationContext());
// If you want to use AppEventsLogger to log events.
AppEventsLogger.activateApp(this);
SoLoader.init(this, /* native exopackage */ false);
}
}
string.xml
<resources>
<string name="app_name">app</string>
<string name="facebook_app_id">180127865836302</string>
</resources>
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
Problem solved:
http://stackoverflow.com/a/43217182/2862728
Hi
Problem solved: in terminal add
rnpm link react-native-fbsdk
Getting this error after following the steps at : https://github.com/facebook/react-native-fbsdk
