Skip to content
This repository was archived by the owner on Apr 2, 2021. It is now read-only.

Need for 0.5.0 version patch - use 4.22.1 version of facebook-android-sdk #339

Closed
wants to merge 2 commits into from

Conversation

marysieek
Copy link

@marysieek marysieek commented May 26, 2017

Hi,

Facebook Android SDK was updated yesterday (facebook/facebook-android-sdk@d47ac93) and due to this fact, we cannot longer use facebook-android-sdk 4.+ version in android/build.gradle for 0.5.0 tag, since it results in regression.

The issue is as follows:

:react-native-fbsdk:processReleaseResources/[mydir]/src/
node_modules/react-native-fbsdk/android/build/intermediates/
res/merged/release/values-v24/values-v24.xml:3: 

AAPT: Error retrieving parent for item: 

No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

Please release 0.5.1 version with fix applied. 😊

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions.

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@facebook-github-bot
Copy link

@marysieek updated the pull request - view changes

@marysieek
Copy link
Author

It is a good practice to use 4.22.1 version explicitly, to avoid regression in the future

@fcmatteo
Copy link

Same for 0.4.0

@dev6rodn
Copy link

I've been battling this issue since Wednesday. Getting this PR in soon would be much appreciated.

@richardfat7
Copy link

Also update your $root\android\app\build.gradle with explicit version if you have added fbsdk as dependency

@dev6rodn
Copy link

dev6rodn commented May 26, 2017

For the sake of completeness, here are the changes I made to get past this issue until the fix is in

android\app\build.gradle

dependencies {
    compile project(':react-native-fbsdk')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"
    //compile 'com.facebook.android:facebook-android-sdk:[4,5)' 
    compile 'com.facebook.android:facebook-android-sdk:[4.22.1)' 
}

node_modules\react-native-fbsdk\android\build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.facebook.react:react-native:+' // support react-native-v0.22-rc+
    // compile('com.facebook.android:facebook-android-sdk:4.+')
    compile('com.facebook.android:facebook-android-sdk:4.22.1')
}

@jhilden
Copy link

jhilden commented May 27, 2017

this might make it a little easier to make the change repeatedly (after a new install or on other team members' machines):

sed -i 's/facebook-android-sdk:4.+/facebook-android-sdk:4.22.1/g' ./node_modules/react-native-fbsdk/android/build.gradle

(btw: @dev6rodn I think you meant this file android/app/build.gradle, right?)

@dev6rodn
Copy link

Yes, that's correct, @jhilden. Thanks for catching that one. I just updated my previous comment.

@ricardofbarros
Copy link

Can we get this merged asap?

@vik228
Copy link

vik228 commented May 29, 2017

Please merge this PR as soon as possible.Our app is not working on production.

@ricardofbarros
Copy link

ping @dzhuowen

@tugorez
Copy link

tugorez commented May 29, 2017

@vik228 in the meantime you could fork the latest working branch and apply this change to your forked version, then replace the dependency and voila!

Actually I did that here, and in my project

yarn add react-native-fbsdk@https://github.com/tugorez/react-native-fbsdk

and everything is working fine. Hope it helps

@kelset
Copy link

kelset commented May 30, 2017

I can confirm that on version 0.6.0 still problem still exists, thanks to @dev6rodn for pointing out a workaround - I just add to modify the node_modules\react-native-fbsdk\android\build.gradle as shown in his comment.

@dev6rodn
Copy link

Instead of modifying the node_modules\react-native-fbsdk\android\build.gradle file, you can get the same outcome by modifying your root build.gradle. Again, for the sake on completeness, here's everything in one place. This is far better because you're free to remove and reinstall your node_modules\ if necessary.

android\app\build.gradle

dependencies {
    compile project(':react-native-fbsdk')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"
    //compile 'com.facebook.android:facebook-android-sdk:[4,5)' 
    compile 'com.facebook.android:facebook-android-sdk:[4.22.1)' 
}

android\build.gradle

buildscript { ... }

project(':react-native-fbsdk') {
  configurations.all {
    resolutionStrategy {
      force 'com.facebook.android:facebook-android-sdk:4.22.1'
    }
  }
}
...
allprojects {
    repositories {
        ...
        configurations.all {
            resolutionStrategy {
              force 'com.facebook.android:facebook-android-sdk:4.22.1'
            }
        }
    }
}

credit to the fine folks who commented here.

fannt added a commit to boilerroomtv/react-native-fbsdk that referenced this pull request May 31, 2017
@mayuce
Copy link

mayuce commented Jun 1, 2017

I found it, I was trying to compile my app which is using facebook sdk. I was made that like augst 2016. When I try to open it today i got same error. I had that line in my gradle " compile 'com.facebook.android:facebook-android-sdk:4.+' " and I went https://developers.facebook.com/docs/android/change-log-4x this page and i found the sdk version while i was running this app succesfully and it was 4.14.1 then I changed that line to " compile 'com.facebook.android:facebook-android-sdk:4.14.1' " and it worked.

@adriancuco
Copy link

Hi,
Still getting the issue 0.6
Please advise about my settings:
apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion "23.0.1"

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 23
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.facebook.react:react-native:+' // support react-native-v0.22-rc+
compile('com.facebook.android:facebook-android-sdk:4.+')
}

Thanks a lot

@GeoffreyPlitt
Copy link

Is this getting merged?

@farazs
Copy link

farazs commented Jun 5, 2017

@dzhuowen seems to be the one who merges pull requests. could we get this merged?

react-native-fbsdk is currently unusable for anyone not able to upgrade their react-native version I believe

@dzhuowen
Copy link
Contributor

dzhuowen commented Jun 5, 2017

Instead of setting the fbsdk to specific version, you can also update the android support library to 25.0.0 in android\app\build.gradle. This shouldn't change any current behavior of the app.
`
android {
compileSdkVersion 25
buildToolsVersion "23.0.1"
...
}

dependencies {
compile project(':react-native-fbsdk')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:25.0.0"
compile "com.facebook.react:react-native:+" // From node_modules
}
`

@rodnolan
Copy link

rodnolan commented Jun 7, 2017

@adriancuco have you followed all these instructions? Your error indicates that you're missing an argument... that argument is described in that section.

@adriancuco
Copy link

@rodnolan. Ahhh, understood.
Sorry about that.

Let me check it out.

Thx

@st0ffern
Copy link

st0ffern commented Jun 7, 2017

@adriancuco not related 😉 update your comment so that other readers will not get confused

@plrdev
Copy link

plrdev commented Jun 10, 2017

If you only up your own compileSdk and build tools, other libraries will complain, but this will help fix those, without changes inside node_modules:

ext {
compileSdkVersion = 25
buildToolsVersion = '25.0.3'
}

subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}

@dev6rodn
Copy link

I have my app running smoothly now with the latest versions of all my dependencies (react, react-native, react-native-fbsdk, etc) and I'm using version 23 of the sdk and build tools. I went through the upgrade process described here: http://facebook.github.io/react-native/docs/upgrading.html. It required some work but I'm glad I did it. I still have to lock down the Android Facebook SDK at version 4.22.1 but that's a minor adjustment, given the version mess I was creating by downgrading my dependencies.

Here's my latest configuration. Your mileage may vary but this is what's working for me right now.

package.json

  "dependencies": {
    "native-base": "^2.1.4",
    "react": "16.0.0-alpha.12", 
    "react-native": "~0.45.0", 
    "react-native-deprecated-custom-components": "^0.1.0",
    "react-native-fbsdk": "^0.6.0", 
    "react-native-facebook-account-kit": "^0.6.2",
    "react-native-image-crop-picker": "^0.13.1",
    "react-native-modal": "^2.0.2",
    "react-native-photo-grid": "0.0.2",
    "react-native-storage": "^0.2.2",
    "react-native-view-shot": "^1.9.1",
    "react-navigation": "^1.0.0-beta.5"
  },

android\build.gradle

project(':react-native-fbsdk') {
    configurations.all {
        resolutionStrategy {
            force 'com.facebook.android:facebook-android-sdk:4.22.1'
        }
    }
}
...
allprojects {
    repositories {
        ...
        configurations.all {
            resolutionStrategy {
                force 'com.facebook.android:facebook-android-sdk:4.22.1'
            }
        }
    }
}

android\app\build.gradle

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    ...
}
...
dependencies {
    compile project(':react-native-fbsdk')
    compile project(':react-native-view-shot')
    compile project(':react-native-image-crop-picker')
    compile project(':react-native-facebook-account-kit')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"
    compile('com.facebook.android:facebook-android-sdk:4.22.1')
}

@igorarkhipenko
Copy link

@dev6rodn Is it still working fine for you? Tried exactly the same configuration with my build and got an error.
No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

I wonder this branch is not merged yet.

@rodnolan
Copy link

@igorarkhipenko my app is still compiling without error. You may have to clean up a few things in order to get over the hump. Give this a try, if you haven't already.

del node_modules\*
yarn install (or npm install)
cd android
gradlew clean
cd ..
react-native run-android

@igorarkhipenko
Copy link

@rodnolan unfortunately, didn't work for me neither. Anyway, thank you for your fast response, sir. Seems like, I've got a worm somewhere in my code.

@rodnolan
Copy link

It was a lot of work but it was helpful to gradually rebuild my app from scratch. I started with a blank app and copied my old code into the new project piece by piece, chunk by chunk. I was very methodical in verifying every major step I took but I eventually found the finish line. Good luck. ;-)

@cdimitroulas
Copy link

Is this going to be merged or not? I do not want to have to manually fix the Facebook SDK to version 4.22.1.

@mortezaalizadeh
Copy link

Is there any plan to merge this back to master branch? My app is completely broken :(

@st0ffern
Copy link

cc @dzhuowen

@dzhuowen
Copy link
Contributor

Sorry for the inconvenience. We'll do a 0.6.1 release to fix sdk version.

@dzhuowen dzhuowen closed this Jun 14, 2017
@cdimitroulas
Copy link

Did you mean 0.5.1?

@st0ffern
Copy link

st0ffern commented Jun 14, 2017

current version is 0.6.0 and he will push a bugfix out, that makes automatic versioning to 0.6.1..

@cdimitroulas
Copy link

But that means I need to upgrade my version of react-native-fbsdk to 0.6.0 just for this...

@farazs
Copy link

farazs commented Jun 14, 2017

Also I believe 0.6.0 requires RN 0.44 or later so it might require a react native upgrade as well.

@st0ffern
Copy link

st0ffern commented Jun 14, 2017

@cdimitroulas @farazs Thanks for info,
@dzhuowen in order to make the bugfix backward compatible please release a 0.5.1 fix to.
see above comments

@dzhuowen
Copy link
Contributor

👍

@kelset
Copy link

kelset commented Jun 15, 2017

Why is 0.6.0 using build tools 25? As said by @marysieek up here it is not a good idea to up them.

I guess I'll have to wait for 0.5.1 and stick to that.

@lensi
Copy link

lensi commented Jun 17, 2017

Still having the issue on 0.6.1.
dev6rodn's workaround still does it though.

@jhilden
Copy link

jhilden commented Jun 19, 2017

We upgraded to version 0.5.1 (I think nobody mentioned here yet that this has finally been built and released to npm 3 days ago) and it fixed the issue for us, while still allowing us not to upgrade React Native just yet (we are still on 0.42).

@pawlowskim
Copy link

React-native 0.44.0 and react-native-fbsdk -0.5.1 also works.

@cdimitroulas
Copy link

I am still having this issue but I can see that version 0.5.1 is installed and that the gradle file inside the fbsdk node_module indeed is pointing to the 4.22.1 version of the sdk.

I can get my project to build using the workaround from this StackOverflow answer which proves that this is related to the react-native-fbsdk.

Is it possible that this is a caching issue? I have tried a variety of different commands to try to get around this but to no avail.
I tried various combinations of: gradlew clean, rm -rf node_modules, npm clear cache, npm install, npm start -- --reset-cache.

Would appreciate some help 😅

@jslok
Copy link

jslok commented Nov 30, 2017

After much debugging, I updated all these:
gradle to 3.01
gradle wrapper to 4.1
compilesdkversion to 26
buildtoolsversion to 26.02
com.android.support:appcompat-v7 to 26+

Now I am able to successfully compile with the latest version of FB SDK.

@dwicao
Copy link

dwicao commented Dec 7, 2017

I came from https://stackoverflow.com/questions/47671206/getting-error-when-run-react-native-run-android

Somehow I got an error in facebook-android-sdk v4.29.0
So I force it to v4.28.0
And it was worked flawlessly on me

android\build.gradle

...
allprojects {
    repositories {
        ...
        configurations.all {
            resolutionStrategy {
                force 'com.facebook.android:facebook-android-sdk:4.28.0'
            }
        }
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet