react-native-location-enabler icon indicating copy to clipboard operation
react-native-location-enabler copied to clipboard

Build Failed

Open shakawy opened this issue 3 years ago • 13 comments

Run android failed to build with the following error:

Execution failed for task ':react-native-location-enabler:compileDebugKotlin'.

last time i tried to build my project was Thursday and everything was normal.

shakawy avatar Nov 06 '22 11:11 shakawy

same for me

wahidshadab avatar Nov 07 '22 02:11 wahidshadab

Same for me unable to build the project

abtomar7788 avatar Nov 07 '22 06:11 abtomar7788

I'm facing the same issue

wcosmas avatar Nov 07 '22 07:11 wcosmas

Hey guys,
@wcosmas, @abtomar7788 , @shakawy, @wahidshadab I had the same issue. It appears that everyone has been experiencing build failures while trying to build Android apps starting from November 4th, 2022. The solution to this failure is to update your react-native version to the latest released patch. React-native has released a new patch from React-native 0.63 and above. Patches for >= 0.63 Incase you are using any version below 0.63 there is no patch available. But there is a work around.

Fix for older react-native (< 0.63)

You may determine your gradle version by looking in your /android/gradle/wrapper/gradle-wrapper.properties file.

If you are on an older version of react-native (for example 0.63 or earlier) that uses gradle version 6.1 or below, you must use a different workaround as gradle 6.1 does not support exclusiveContent.

Add this in the allprojects area of your android/build.gradle file.

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
    configurations.all {
        resolutionStrategy {
            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }

I hope it works for you too.

shadabwahidullah avatar Nov 07 '22 08:11 shadabwahidullah

@shadabwahidullah worked. Thanks! btw im using RN 0.67

shakawy avatar Nov 07 '22 09:11 shakawy

@shakawy as I mentioned above if you are using RN 0.63 or above you should use the latest patch released for that version. In your case, Its more convenient to update your RN version to 0.67.5.

shadabwahidullah avatar Nov 07 '22 10:11 shadabwahidullah

Hello!

Thanks @shadabwahidullah for your solution, unfortunately it didn't work for me, I've already faced this issue with another lib and patched RN before this issue happened.

Any other suggestion?

EDIT

adding:

buildscript {
    ext {
        kotlinVersion = '1.6.21'
        ...

solved my problem

JohnBerd avatar Nov 08 '22 14:11 JohnBerd

@JohnBerd Hello Unfortunately, I have no other suggestions.

shadabwahidullah avatar Nov 09 '22 09:11 shadabwahidullah

I am having the same error. I also followed the Patches link since my RN is 0.70.6 (which I reverted to 0.70.5). But I am still getting issue while build. Any insight?

ObaidAshraf avatar Dec 22 '22 19:12 ObaidAshraf

I am having the same error. I also followed the Patches link since my RN is 0.70.6 (which I reverted to 0.70.5). But I am still getting issue while build. Any insight?

Try this: https://github.com/sashko9807/react-native-location-enabler/commit/65edcb1045672684b07481c3f5b397d52e3a9aa0

sashko9807 avatar Jan 10 '23 23:01 sashko9807

I am having the same error. I also followed the Patches link since my RN is 0.70.6 (which I reverted to 0.70.5). But I am still getting issue while build. Any insight?

Try this: sashko9807/react-native-location-enabler@65edcb1

Didn't work for me .. I tried setting RN version to both 0.70.6 and 0.70.5.

  1. Keeping RN version to 0.70.6 and applying the patch, I am getting build failed.
  2. With RN version 0.70.5 and applying the patch, I am getting some version React Native version mismatch error.

ObaidAshraf avatar Jan 18 '23 18:01 ObaidAshraf

Didn't work for me .. I tried setting RN version to both 0.70.6 and 0.70.5.

  1. Keeping RN version to 0.70.6 and applying the patch, I am getting build failed.
  2. With RN version 0.70.5 and applying the patch, I am getting some version React Native version mismatch error.

With the change I posted above, I successfully compiled a project using this library on react native versions 0.71.0 and 0.70.6. What is the exact error you receive?

sashko9807 avatar Jan 18 '23 21:01 sashko9807

Hello!

Thanks @shadabwahidullah for your solution, unfortunately it didn't work for me, I've already faced this issue with another lib and patched RN before this issue happened.

Any other suggestion?

EDIT

adding:

buildscript {
    ext {
        kotlinVersion = '1.6.21'
        ...

solved my problem

Thank you so much for this answer.. I worked perfectly

nandgreat avatar Feb 09 '23 15:02 nandgreat