Since the project uses a non-standard name for the android folder with a capital 'A', rnpm doesn't link the Android project in OSX with Case-sensitive Journaled HFS+ File System.
In this case you can manually set up the Android project.
In settings.gradle, include the sdk subproject and specify the subproject path.
include ':react-native-fbsdk'
project(':react-native-fbsdk').projectDir = new File(settingsDir, '../node_modules/react-native-fbsdk/Android')
In app/build.gradle, add sdk to dependencies.
//...
dependencies {
//...
compile project(":react-native-fbsdk")
}
Then you can follow the readme to finish the setup.
I'm closing the issue here. Please file the issue to rnpm.
I was first planning to file the issue to rnpm, then I realized that react-native init had somewhat standardized the use of 'android' and 'ios' folder names (all small).
I am pretty much sure this problem will be faced by lot of linux users. It would be a lot of time wasted for a lot of developers.
Also, the manual setup is needed for iOS as well. The rnpm doesn't link the iOS project either.
In XCode, right click Libraries, click Add Files to [Your Project]. Add the file node_modules/react-native-fbsdk/iOS/RCTFBSDK.xcodeproj.
In the Project Navigator, select your project, select Build Phases in your build target. Expand Link Binary with Libraries. Click the plus button and add libRCTFBSDK.a under Workspace.
Thanks @dzhuowen, it works now.
In case somebody gets this error on Ubuntu 14.04
* What went wrong:
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':react-native-fbsdk'.
> failed to find Build Tools revision 23.0.2
take a look at this post from stackoverflow. Installing Build Tools revision 23.0.2 via the android tools GUI didn't work for me.
@maikokuppe Hey it helped me :
take a look at this post from stackoverflow. Installing Build Tools revision 23.0.2
but now I have another error : error cannot find symbol : new FBSDKPackage(mCallbackManager).
However, I added in my project include ':react-native-fbsdk'
project(':react-native-fbsdk').projectDir = new File(settingsDir, '../node_modules/react-native-fbsdk/Android') and
compile project(":react-native-fbsdk"), and of course rnpm link as @dzhuowen said ... But still have the error :/
@MayeuldP looks like you have a typo, its FBSDKPackage without 's'.
@syaau Oup's no it's a mistake, my bad ! This is the copy-paste packages function that I have.... :
@Override
protected List<ReactPackage> getPackages() {
mCallbackManager = new CallbackManager.Factory().create();
ReactPackage packages[] = new ReactPackage[]{
new MainReactPackage(),
new VectorIconsPackage(),
new RNSharePackage(),
new FacebookLoginPackage(),
new RNGoogleSigninPackage(this),
new FBSDKPackage(mCallbackManager)
};
return Arrays.<ReactPackage>asList(packages);
}```
Ok Build Successfull . I think I have trouble with rnpm... I didn't added this import import com.facebook.reactnative.androidsdk.FBSDKPackage;
in my project.
EDIT : In fact, no, when I Launch my app, it crash, no way to know where's the problem... :'(
@MayeuldP: try android/gradlew --stop && react-native run-android. Rerun npm start afterwards.
Maybe there is something old in the cache or on the device or in the packager or whatever.
@maikokuppe I tried.. But doesn't work, but really wtf ! I deleted all the files which concerned react-native-fbsdk in gradle, manifest, MainActivity.java,etc,... but my app still crashing... Is there any way to find where and why my app crash ?
I just get this :
Starting the app on ......
Starting : Intent { cmp=com.movieproject/.MainActivity }
and crash... The output is not very clear... :/
EDIT : It definitely not from the node_module that the error comes... So I have really no idea now. :(
@MayeuldP Sorry, I don't know anything about Java or native Android developing. Can't help you with that.
@maikokuppe I did some changements, and now I have this error when I build the project,
Unexpected top-level exception ....multiple dex files define....C:\ProgrammFiles\java\jdk1.7.0_79\bin\java.exe did you already had this error ?
@MayeuldP Nope, never seen that. Also I'm using Ubuntu, so there might be some differences.
@maikokuppe Ok, I did some changement, and doesn't have this error anymore ! thank's anyway for your help.
@MayeuldP I am facing the same issue. Followed all the steps. Solved the issue of build version 23.0.1.Build Successfull.
But, app crashes on launnch.
Can u tell me what changes you made ?
Try cd android/ && ./gradlew clean and restart build... If it doesn't work, I really don't know...
@MayeuldP , Still the same issue man.
debug.apk is running fine. But, release.apk is crashing
Any idea about that ?
@JatinKinra You cannot generate the realease.apk ? Or yes you can, and when you launch it, it crashes ? Because me, I didn't generate a realease.apk... :/ Are you sure that you correctly followed all the steps for generate a signed apk ?
@MayeuldP I am able to generate the signed apk, but it crashes. Now, the case is worse, debug apk is also crashing after running the above mentioned command i.e. gradlew clean.
This has become a mess now. There is no way to find why app is crashing.
Hi
I debugged the app step by step. This is what I got-
Before adding the fbsdk manually(rnpm is unable to do it), app runs fine.
But, once I include fbsdk in build.gradle and seetings.gradle, App crashes.
Can anyone tell what is the issue here ?
This link has my source code. Can anybody have a look ?
http://stackoverflow.com/questions/37719258/adding-facebook-sdk-to-react-native-project
@syaau, we'll fix the directory name in the next release. Feel free to submit a pull request if you would like to.
Most helpful comment
In this case you can manually set up the Android project.
In settings.gradle, include the sdk subproject and specify the subproject path.
In app/build.gradle, add sdk to dependencies.
Then you can follow the readme to finish the setup.
I'm closing the issue here. Please file the issue to rnpm.