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

Error with GeneratePackageListTask when build for Android #46069

Closed
R1KO opened this issue Aug 16, 2024 · 39 comments
Closed

Error with GeneratePackageListTask when build for Android #46069

R1KO opened this issue Aug 16, 2024 · 39 comments
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer

Comments

@R1KO
Copy link

R1KO commented Aug 16, 2024

Description

A problem was found with the configuration of task ':app:generateAutolinkingPackageList' (type 'GeneratePackageListTask').

  • In plugin 'com.facebook.react' type 'com.facebook.react.tasks.GeneratePackageListTask' property 'autolinkInputFile' specifies file '/Users/admin/projects/my_app/android/build/generated/autolinking/autolinking.json' which doesn't exist.

Steps to reproduce

  1. yarn install
  2. yarn react-native run-android

I tried to create this file with content {} but it doesn't work too.

React Native Version

0.75.1

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.5
  CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Memory: 798.14 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.5.1
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 10.8.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.07.15.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 15.0.1/15A507
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.3.4
    path: /usr/local/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.75.1
    wanted: 0.75.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: false

Stacktrace or Logs

Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong:
A problem was found with the configuration of task ':app:generateAutolinkingPackageList' (type 'GeneratePackageListTask'). - In plugin 'com.facebook.react' type 'com.facebook.react.tasks.GeneratePackageListTask' property 'autolinkInputFile' specifies file '/Users/admin/projects/my_app/android/build/generated/autolinking/autolinking.json' which doesn't exist. Reason: An input file was expected to be present but it doesn't exist. Possible solutions: 1. Make sure the file exists before the task is called. 2. Make sure that the task which produces the file is declared as an input. For more information, please refer to https://docs.gradle.org/8.7/userguide/validation_problems.html#input_file_does_not_exist in the Gradle documentation.

Reproducer

https://github.com/R1KO

Screenshots and Videos

No response

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications. labels Aug 16, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:

@LakshanKarunathilake
Copy link

LakshanKarunathilake commented Aug 16, 2024

I am also facing the same issue

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem was found with the configuration of task ':app:generateAutolinkingPackageList' (type 'GeneratePackageListTask').
    • In plugin 'com.facebook.react' type 'com.facebook.react.tasks.GeneratePackageListTask' property 'autolinkInputFile' specifies file '/Users/lakshankarunathilake/WebstormProjects/PlayBook/android/build/generated/autolinking/autolinking.json' which doesn't exist.

      Reason: An input file was expected to be present but it doesn't exist.

      Possible solutions:

      1. Make sure the file exists before the task is called.
      2. Make sure that the task which produces the file is declared as an input.

      For more information, please refer to https://docs.gradle.org/8.7/userguide/validation_problems.html#input_file_does_not_exist in the Gradle documentation.

@cortinico
Copy link
Contributor

@R1KO

@R1KO where is the repro?

@R1KO
Copy link
Author

R1KO commented Aug 17, 2024

@R1KO

@R1KO where is the repro?

This is a private company repository, I cannot share it, but I am ready to provide all the necessary information

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Aug 17, 2024
@1500256797
Copy link

meet same error after update 0.75.1


info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 


FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:generateAutolinkingPackageList' (type 'GeneratePackageListTask').
  - In plugin 'com.facebook.react' type 'com.facebook.react.tasks.GeneratePackageListTask' property 'autolinkInputFile' specifies file '/Users/jianjianjianjian/Documents/rn_74_camera_demo/android/build/generated/autolinking/autolinking.json' which doesn't exist.
    
    Reason: An input file was expected to be present but it doesn't exist.
    
    Possible solutions:
      1. Make sure the file exists before the task is called.
      2. Make sure that the task which produces the file is declared as an input.
    
    For more information, please refer to https://docs.gradle.org/8.8/userguide/validation_problems.html#input_file_does_not_exist in the Gradle documentation.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 3s

@markozix
Copy link

Same thing happening to me, I tried downgrading among other things in order to try to resolve the issue, didn't help, only new things break :)

@cortinico
Copy link
Contributor

I'm happy to help debug/fix this but without steps on how to reproduce it's literally impossible

@markozix
Copy link

Maybe @1500256797 can share his repo, since from the posted error it seems it is just a camera demo app and then @cortinico you can have a look? I'm not allowed to share my app code.

@Gautham495
Copy link

I am getting the same

@danlordan
Copy link

danlordan commented Aug 17, 2024

Got this today as well:

  1. Project is running on React-Native 0.73.8
  2. In android/gradle/wrapper/gradle-wrapper.properties, I have distributionUrl set to https\://services.gradle.org/distributions/gradle-8.3-all.zip
  3. Today, for the first time, I got a new error when running the project - Minimum supported Gradle version is 8.7. Current version is 8.3. If using the gradle wrapper, try editing the distributionUrl in /Users/danlordan/Documents/Work/sen-navengage-frontend/android/gradle/wrapper/gradle-wrapper.properties to gradle-8.7-all.zip
  4. I updated the distributionUrl to the one suggested by the warning message.
  5. Running yarn a gave me the same issue as above:
* What went wrong:
A problem was found with the configuration of task ':app:generateAutolinkingPackageList' (type 'GeneratePackageListTask').
  - In plugin 'com.facebook.react' type 'com.facebook.react.tasks.GeneratePackageListTask' property 'autolinkInputFile' specifies file '{localDirectory}/android/build/generated/autolinking/autolinking.json' which doesn't exist.

    Reason: An input file was expected to be present but it doesn't exist.

    Possible solutions:
      1. Make sure the file exists before the task is called.
      2. Make sure that the task which produces the file is declared as an input.

    For more information, please refer to https://docs.gradle.org/8.7/userguide/validation_problems.html#input_file_does_not_exist in the Gradle documentation.
```

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

When I opened Android Studio I got the same minimum supported version and updating through the GUI just made the same change to the gradle-wrapper with the same effect.

@1500256797
Copy link

1500256797 commented Aug 18, 2024

@cortinico

1、here is repo demo

https://github.com/ZhenQian-keystone/rn_74_camera_demo

2、 Reproduction steps:
When you clone my repository, you first need to run 'yarn'. Then, when you use 'npx react-native android', you will encounter this error. When you revert to the previous commit, it will build successfully. Is there a problem with the configuration?

Maybe @1500256797 can share his repo, since from the posted error it seems it is just a camera demo app and then @cortinico you can have a look? I'm not allowed to share my app code.

@ChagitCharazi
Copy link

I am also encountering this.

react-native: 0.73.8

This is my error:

* What went wrong:
A problem was found with the configuration of task ':app:generateAutolinkingPackageList' (type 'GeneratePackageListTask').
  - In plugin 'com.facebook.react' type 'com.facebook.react.tasks.GeneratePackageListTask' property 'autolinkInputFile' specifies file '[root]/android/build/generated/autolinking/autolinking.json' which doesn't exist.
    
    Reason: An input file was expected to be present but it doesn't exist.
    
    Possible solutions:
      1. Make sure the file exists before the task is called.
      2. Make sure that the task which produces the file is declared as an input.
    
    For more information, please refer to https://docs.gradle.org/8.8/userguide/validation_problems.html#input_file_does_not_exist in the Gradle documentation.

Any solutions?

@MelMayssonOwen
Copy link

Same issue with 0.74.5

It wouldn't even go this far using yarn android, had to do ./gradlew app:installDevelopmentDebug -PreactNativeDevServerPort=8081

or else was getting this error

Cannot locate tasks that match 'app:installDebug' as task 'installDebug' is ambiguous in project ':app'. Candidates are: 'installDevelopmentDebug', 'installDevelopmentDebugAndroidTest', 'installProductionDebug', 'installProductionDebugAndroidTest'.```

@Arthur-Noh
Copy link

Arthur-Noh commented Aug 19, 2024

It seems to be the same issue. Has anyone try this solution?

#46047 (comment)

@0x1af2aec8f957
Copy link

0x1af2aec8f957 commented Aug 19, 2024

Same error.

* What went wrong:
A problem was found with the configuration of task ':app:generateAutolinkingPackageList' (type 'GeneratePackageListTask').
  - In plugin 'com.facebook.react' type 'com.facebook.react.tasks.GeneratePackageListTask' property 'autolinkInputFile' specifies file '@workDir/android/build/generated/autolinking/autolinking.json' which doesn't exist.
    
    Reason: An input file was expected to be present but it doesn't exist.
    
    Possible solutions:
      1. Make sure the file exists before the task is called.
      2. Make sure that the task which produces the file is declared as an input.
    
    For more information, please refer to https://docs.gradle.org/8.8/userguide/validation_problems.html#input_file_does_not_exist in the Gradle documentation.

@diego-antonelli
Copy link

I solved this issue with the following command:
chmod +x node_modules/.bin/rnc-cli

Seems like yarn links the new version of rn-cli but doesnt give permission to execute. After I executed the command above the issues were gone.

@cortinico
Copy link
Contributor

Hey @1500256797,
I'm answering you as you're the only one providing a reproducer:

The problem you're having is in the settings.gradle file: https://github.com/ZhenQian-keystone/rn_74_camera_demo/blob/main/android/settings.gradle

Specifically you need to change it as follows:

rootProject.name = 'rn_74_camera_demo'
+pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
+plugins { id("com.facebook.react.settings") }
+extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
- apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()

This is clearly stated in the upgrade-helper here:
https://react-native-community.github.io/upgrade-helper/?from=0.74.5&to=0.75.1#RnDiffApp-android-settings.gradle

I suspect most of the other build failures you folks are having are similar issues (you haven't properly followed the upgrade helper).

I'll close here as reproducer by @R1KO was never provided.

Please open separate issues + provide repros and we can look into what failed your upgrade.

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Attention Issues where the author has responded to feedback. labels Aug 19, 2024
@MelMayssonOwen
Copy link

MelMayssonOwen commented Aug 19, 2024

Hey @1500256797, I'm answering you as you're the only one providing a reproducer:

The problem you're having is in the settings.gradle file: https://github.com/ZhenQian-keystone/rn_74_camera_demo/blob/main/android/settings.gradle

Specifically you need to change it as follows:

rootProject.name = 'rn_74_camera_demo'
+pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
+plugins { id("com.facebook.react.settings") }
+extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
- apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()

This is clearly stated in the upgrade-helper here: https://react-native-community.github.io/upgrade-helper/?from=0.74.5&to=0.75.1#RnDiffApp-android-settings.gradle

I suspect most of the other build failures you folks are having are similar issues (you haven't properly followed the upgrade helper).

I'll close here as reproducer by @R1KO was never provided.

Please open separate issues + provide repros and we can look into what failed your upgrade.

It seems like that user is also having issues with rn 0.74.5, why mention the upgrade helper for rn 75 ?

@kikeztw
Copy link

kikeztw commented Aug 19, 2024

I'm having the same problem. Is there any solution for this? 3 days ago this wasn't happening

react-native 0.74.3

@rafaelvinicius
Copy link

RN 0.75.1
I'm still having this problem. I tried some recommendations, but nothing worked.

@NidhiBhansali1923
Copy link

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file
distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file.
react {
autolinkLibrariesWithApp()
}

Step-4 Remove below lines from app/build.gradle file.
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle")
applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file.
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property.
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

@theblues1900
Copy link

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }

Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

U saved me, i love u so much <3

@MelMayssonOwen
Copy link

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }

Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

Thank you so much, it worked !

yarn android

Did you change anything to your package.json to still be able to run it this way ? I have to run it this way now ./gradlew app:installDevelopmentDebug :/

@DanielFlockhart
Copy link

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }

Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

This worked for me! Thanks bud.

@NidhiBhansali1923
Copy link

./gradlew app:installDevelopmentDebug

I'm having the same problem with "react-native 0.74.3"
I have followed the below steps and able to build application successfully.
Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"
Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip
Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }
Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)
Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'ProjectName'
Step-7 Delete the .build, .gradle folder from android
Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application
Thanks!!

Thank you so much, it worked !

yarn android

Did you change anything to your package.json to still be able to run it this way ? I have to run it this way now ./gradlew app:installDevelopmentDebug :/

You just have to install the node modules dependancy again as we updated the version for react-native inside the package.json file.
and then simply run the app by using "yarn android"
Or you can follow the any specific env as per your script.

@eehhssaan
Copy link

You absolute lege

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }

Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

You Absolute Legend, I was stuck on it for 18 hours. You will be in my stories!!!

@Biplovkumar
Copy link

Same Issue. Please reopen this one.

@adamalexander
Copy link

This should not be closed. Still very much an issue. Unable to solve myself.

@Andy0550
Copy link

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }

Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

Thank you so much man!!! 💦
Not All Heroes Wear Capes ❤️

@danlordan
Copy link

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }

Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

I can confirm this change also worked in react-native version 0.73.8, didn't need to upgrade to react-native@74.4. Thank you @ NidhiBhansali1923!

@Mario-e777
Copy link

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }

Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

This worked for me ❤️❤️❤️

@gitstashapply
Copy link

Thank you! @NidhiBhansali1923
Can someone explain what was the changes in gradle so we need this workaround?

@hamedfoodready
Copy link

hamedfoodready commented Sep 3, 2024

I have the same issue, but i used Expo dev-client i dont have android Folder in my app. what should i do ?
Screenshot 2024-09-03 at 10 29 32 AM

@ailtonaires
Copy link

I have the same problem. I didn't want to downgrade. Any other solution?

image

package.json

"dependencies": {
"@react-native-async-storage/async-storage": "^1.24.0",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-firebase/app": "^20.3.0",
"@react-native-firebase/auth": "^20.3.0",
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.11.0",
"@react-navigation/stack": "^6.4.1",
"@stripe/stripe-terminal-react-native": "^0.0.1-beta.20",
"@tanstack/react-query": "^5.51.23",
"axios": "^1.7.3",
"react": "^18.3.1",
"react-native": "^0.75.2",
"react-native-gesture-handler": "^2.18.1",
"react-native-ide": "^0.0.2",
"react-native-reanimated": "^3.15.0",
"react-native-safe-area-context": "^4.10.8",
"react-native-screens": "^3.34.0",
"styled-components": "^6.1.12"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.74.87",
"@react-native/eslint-config": "0.74.87",
"@react-native/metro-config": "0.74.87",
"@react-native/typescript-config": "0.74.87",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "^18.3.1",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

@MAsadIlyasNajum
Copy link

MAsadIlyasNajum commented Sep 5, 2024

Issue with :app:generateAutolinkingPackageList on React Native 0.75.2
I encountered the following error while upgrading my React Native project to version 0.75.2:

:app:generateAutolinkingPackageList' (type 'GeneratePackageListTask').
- In plugin 'com.facebook.react' type 'com.facebook.react.tasks.GeneratePackageListTask' property 'autolinkInputFile' specifies file

Steps I Took to Resolve the Issue:
After researching the issue, I found a solution using the official React Native upgrade helper while comparing the changes from version 0.74.3 to 0.75.2.

It turns out I had missed a few key guidelines during the upgrade. Here's what I did to fix the issue:

Added missing configuration: Specifically, I updated my settings.gradle file as per the guide. The necessary changes were related to autolinking libraries from the command.

Added in settings.gradle on top of file:

pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

Removed from settings.gradle:

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

After applying these changes, the error was resolved, and autolinking worked correctly again.
please try it. @ailtonaires

@chrisContarino
Copy link

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }

Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

bro you are a legend, you solved my issue with builds !

@creeper12356
Copy link

creeper12356 commented Oct 11, 2024

I'm having the same problem with "react-native 0.74.3"

I have followed the below steps and able to build application successfully.

Step-1 Update package.json file for "react-native": "0.74.3" to "react-native": "0.74.4"

Step-2 Update the distributionUrl inside the gradle-wrapper.properties file distributionUrl=https://services.gradle.org/distributions/gradle-8.7-bin.zip

Step-3 Add autolinkLibrariesWithApp() within the app/build.gradle file. react { autolinkLibrariesWithApp() }

Step-4 Remove below lines from app/build.gradle file. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") applyNativeModulesAppBuildGradle(project)

Step-5 Remove below line from settings.gradle file. apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Step-6 Add below lines above the rootProject.name property. pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'ProjectName'

Step-7 Delete the .build, .gradle folder from android

Step-8 Remove node_modules, yarn.lock file and run yarn android command to build the application

Thanks!!

You must be the superhero🦸 saving hundreds of people struggling with these sticky dependencies. 😄

@SukoonAdmin
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests