(React Native): Execution failed for task ':app:generatePackageList'

15,542

Solution 1

I just ran across the same problem and was able to track down why it was happening on my system. Using the --stacktrace flag helped to figure out what was going on, which ended up pointing to the react-native-community/cli package.

After scanning the issues and PRs in the react-native-community/cli repo, I found this PR https://github.com/react-native-community/cli/pull/1396 which adds support for Gradle 7.

I had Gradle 7 on my system and downgrading to Gradle 6, running gradle wrapper, then ./gradlew clean allowed me to move on.

Hope that solves your issue, or at least gives you some insight on how to track it down on your system!

Solution 2

Use Gradle Version 6.9

Here are the highlights of this release:

  • This is a small backport release.
  • Java 16 can be used to compile when used with Java toolchains
  • Dynamic versions can be used within plugin declarations
  • Native support for Apple Silicon processors

Use Gradle Wrapper to change the Version.

./gradlew wrapper --gradle-version 6.9

Solution 3

+1 for downgrade to 6. I wanted to do some upgrades today, but ended up opposite.

Solution 4

Upgrade your react-native version to the latest one with npx react-native upgrade

I had to upgrade from JDK 1.8 to 11 and this error occurred.

Thanks to J Myers answer I found that I had to upgrade the react native version: https://github.com/react-native-community/cli/pull/1396

Solution 5

Replacing distributionUrl with https\://services.gradle.org/distributions/gradle-6.9-all.zip in gradle/wrapper/gradle-wrapper.properties fixed everything for me. Thank GOD

Share:
15,542

Related videos on Youtube

Romero Antonio Ramos de Mendon
Author by

Romero Antonio Ramos de Mendon

Updated on September 16, 2022

Comments

  • Romero Antonio Ramos de Mendon
    Romero Antonio Ramos de Mendon over 1 year

    I am generating an apk of a project that I developed using React Native. But when I run the command ./gradlew assembleRelease The following error appears:

    > Configure project :react-native-audio
    WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
    It will be removed in version 5.0 of the Android Gradle plugin.
    For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
    
    > Task :app:generatePackageList FAILED
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script 'C:\Users\romer\ProjetoAP\Gravador\teste\Gravador_de_audio\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 131
    
    * What went wrong:
    Execution failed for task ':app:generatePackageList'.
    > argument type mismatch
    
    * 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
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
    
    BUILD FAILED in 24s
    1 actionable task: 1 executed
    PS C:\users\romer\ProjetoAP\Gravador\teste\Gravador_de_audio\android>
    

    How to solve this problem?

  • Hakan
    Hakan almost 3 years
    Gradle doesnt support Java 16 except version 7.0 for Gradle. And react-native-cli doesnt support Gradle 7.0. What a incredible day :/
  • Abdul Basit Mangat
    Abdul Basit Mangat over 2 years
    Correction please ./gradlew wrapper
  • Amit Bravo
    Amit Bravo over 2 years
    I am switching back to jdk 8
  • dontdownvoteme
    dontdownvoteme over 2 years
    @AbdulBasit ´gradlew wrapper´ is for windows users, not everyone uses MAC!
  • dontdownvoteme
    dontdownvoteme over 2 years
    this didnt work for me: "Minimum supported Gradle version is 7.0.2. Current version is 6.9."
  • he77kat_
    he77kat_ over 2 years
    Same here: "Minimum supported Gradle version is 7.0.2. Current version is 6.9" and that's all she wrote.
  • Mehrad Farahnak
    Mehrad Farahnak over 2 years
    @Amit Bravo u can use jdk 11 with no problem
  • Lukas Heiligenbrunner
    Lukas Heiligenbrunner over 2 years
    Thx a lot, saved my day. works also with openjdk-17 for me (: