Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build on RN 0.62 #1822

Closed
marf opened this issue Mar 26, 2020 · 25 comments
Closed

Cannot build on RN 0.62 #1822

marf opened this issue Mar 26, 2020 · 25 comments

Comments

@marf
Copy link

marf commented Mar 26, 2020

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

@xuqianjin
Copy link

same issue

@geroale
Copy link

geroale commented Mar 27, 2020

Same issue also here

@andreidubov
Copy link
Contributor

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.

@marf
Copy link
Author

marf commented Mar 27, 2020

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.

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

@Zestpond
Copy link

Same issue :(

@phillipkey
Copy link

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?

@marf
Copy link
Author

marf commented Mar 28, 2020

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.

@AustinHunt
Copy link

@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

@AustinHunt
Copy link

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:

  1. Added the last two lines of the following to 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();
  1. I then followed @marf advice and changed CodePush.java by doing the following:
    Line 157
isLiveReloadEnabled = devInternalSettings.isHotModuleReplacementEnabled();

It used to be:

isLiveReloadEnabled = devInternalSettings.isReloadOnJSChangeEnabled();
  1. My project built! I'm assuming that it will work as expected, but need to do more testing. Obviously there is some kind of configuration error related to the latest version of RN (0.62). This needs to be addressed asap since the temporary fix is not ideal. @andreidubov I hope this helps.

@dpyeates
Copy link

The solution posted by @AustinHunt above worked for me.

@wildseansy
Copy link

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"

@AustinHunt
Copy link

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
Copy link

solved in #1829

@ghost
Copy link

ghost commented Mar 31, 2020

@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.

@alexandergoncharov-zz
Copy link
Contributor

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 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.

@ghost
Copy link

ghost commented Mar 31, 2020

@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'

@lukebars
Copy link

@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'

Have you updated your build.gradle?

@tiendn
Copy link

tiendn commented Apr 1, 2020

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.

@OmarBasem
Copy link

Doest work for me either

@tiendn
Copy link

tiendn commented Apr 4, 2020

Try with #1831 (comment), it worked for me !

@theill
Copy link

theill commented Apr 12, 2020

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')

@madandrija
Copy link

madandrija commented Apr 13, 2020

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 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, 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?

@Gustash
Copy link

Gustash commented Apr 20, 2020

@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

@OsamaKhan220
Copy link

OsamaKhan220 commented Apr 26, 2020

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

@GIRIRAJNAGAR768
Copy link

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

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

No branches or pull requests