Hello,
when I try to build an app based on RN 0.62 and using latest version of CodePush I get this error:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve project :react-native-code-push.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-code-push:
- None of the consumable configurations have attributes.
How can this be fixed?
Thank you,
Marco
same issue
Same issue also here
Hi @marf ,
Thank you for reporting!
Try to add the following additions to your android/settings.gradle file:
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
We are investigating this issue now, let me know if this helped you.
Hi @marf ,
Thank you for reporting!Try to add the following additions to your
android/settings.gradlefile:include ':app', ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')We are investigating this issue now, let me know if this helped you.
Hello @andreidubov,
I have tried adding that line but now I got this error:
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :react-native-code-push.
Thank you
Same issue :(
Hi @marf ,
Thank you for reporting!Try to add the following additions to your android/settings.gradle file:
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
We are investigating this issue now, let me know if this helped you.
@andreidubov even after applying your solution, i am getting the same error found in issue #1823 .
Any update on when this will be resolved?
Quick update.
By applying:
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
below:
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
in settings.gradle (I was placing it above that line) it seems to work, I have had also to change this line: CodePush.java and replace isReloadOnJSChangeEnabled to isHotModuleReplacementEnabled as suggested here #1823
since I have read that with Rn 0.62 Fast Refresh has been enabled by default and replaced hot reload.
This is clearly a workaround and we are waiting for the official fix.
Hope this helps.
@marf Thanks for the update. I'm about to try and will give feedback on whether or not it works for me. I'm in the middle of bootstrapping a clean version of RN 0.62
My project uses RN 0.62.0
@marf for me, following the instructions for RN >= 0.60 for Android I get these errors:
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :react-native-code-push.
ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :react-native-code-push.
ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :react-native-code-push.
ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :react-native-code-push.
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :react-native-code-push.
Here were my steps afterwards:
settings.gradle for my main project.rootProject.name = 'HailTrace'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
After trying to build, I received this error:
error: cannot find symbol
isLiveReloadEnabled = devInternalSettings.isReloadOnJSChangeEnabled();
isLiveReloadEnabled = devInternalSettings.isHotModuleReplacementEnabled();
It used to be:
isLiveReloadEnabled = devInternalSettings.isReloadOnJSChangeEnabled();
The solution posted by @AustinHunt above worked for me.
To patch this for now, I added this to my yarn's postinstall so it doesn't break other users' code on my team:
sed -i -e "s/isReloadOnJSChangeEnabled/isHotModuleReplacementEnabled/g" "node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java"
To patch this for now, I added this to my yarn's postinstall so it doesn't break other users' code on my team:
sed -i -e "s/isReloadOnJSChangeEnabled/isHotModuleReplacementEnabled/g" "node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java"
This is a nice solution. I've found it semi-frustrating every time I install a new yarn module to need to replicate step 3.
@lukebars is there anything we need to change besides updating the code push version? I'm still getting the error even after #1829 upgrade
> Could not resolve all task dependencies for configuration ':app:debugAndroidTestCompileClasspath'.
> Could not resolve project :react-native-code-push.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-code-push:
- None of the consumable configurations have attributes.
Hi all,
Thanks for reporting!
As @lukebars mentioned, https://github.com/microsoft/react-native-code-push/pull/1829 solved this issue and we made new release: https://github.com/microsoft/react-native-code-push/releases/tag/v6.2.0
@bgold0, Please check the updated docs setup section: https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-and-configuration-for-react-native-060-version-and-above-android
You have to add project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') to your android/settings.gradle file.
I'm going to close this issue for now. Please feel free to reopen it if you have any questions.
@alexandergoncharov This has always been in my android/settings.gradle file
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app'
@alexandergoncharov This has always been in my
android/settings.gradlefileproject(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app'
Have you updated your build.gradle?
I did with 4 steps as the docs guide, but it doesn't work with rn0.62
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve project :react-native-code-push.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-code-push:
- None of the consumable configurations have attributes.
Doest work for me either
Try with https://github.com/microsoft/react-native-code-push/issues/1831#issuecomment-608996707, it worked for me !
That worked for me too .. I had to change from this
...
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
to (notice I've moved the code-push line BELOW the apply line and merged it with the already existing include ':app' which was there). I initially just included the line above together with the rest of the includes I have .. and kept the include ':app' separate as the last line - but that won't work.
...
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
Hi all,
Thanks for reporting!As @lukebars mentioned, #1829 solved this issue and we made new release: https://github.com/microsoft/react-native-code-push/releases/tag/v6.2.0
@bgold0, Please check the updated docs setup section: https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-and-configuration-for-react-native-060-version-and-above-android
You have to addproject(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')to yourandroid/settings.gradlefile.I'm going to close this issue for now. Please feel free to reopen it if you have any questions.
@alexandergoncharov, not sure what you mean by "solved this" when, on RN 0.62 and RNCodePush 0.62, we have to manually add the changes suggested in this and the related issue? I would assume solving the issue would mean having autolinking working?
@madandrija if you want autolinking you just need this in your react-native.config.js
module.exports = {
dependencies: {
'react-native-code-push': {
platforms: {
android: {
sourceDir: '../node_modules/react-native-code-push/android/app',
},
},
},
},
};
But I agree that this should be fixed on a package level, and we shouldn't have to do this manual work
Hello
By adding ths:
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
after this line:
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
in your settings.gradle file and add this line at top:
import com.microsoft.codepush.react.CodePush;
and this in ReactNativeHost function:
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
in your MainApplication.java file and dont forget to add this:
<string name="CodePushDeploymentKey">deploymentKey</string>
in your android/app/src/main/res/values/strings.xml file, it worked for me.
hopefully, it will work for u as well
thanks
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
put these line at bottom of settings.gradle..it worked for me
Most helpful comment
Quick update.
By applying:
include ':app', ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')below:
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)in
settings.gradle(I was placing it above that line) it seems to work, I have had also to change this line: CodePush.java and replaceisReloadOnJSChangeEnabledtoisHotModuleReplacementEnabledas suggested here #1823since I have read that with Rn 0.62 Fast Refresh has been enabled by default and replaced hot reload.
This is clearly a workaround and we are waiting for the official fix.
Hope this helps.