1

I am trying to generate APK but i run into an Obstacle, I am getting this As error :

> Task :react-native-gesture-handler:generateReleaseRFile FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-gesture-handler:generateReleaseRFile'.
> Could not resolve all files for configuration ':react-native-gesture-handler:releaseCompileClasspath'.
   > Failed to transform react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-symbol-with-package-name, com.android.build.api.attributes.BuildTypeAttr=release, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
      > Could not find react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0).
        Searched in the following locations:
            https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0-release.aar

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

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

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

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.

BUILD FAILED in 2m 8s
62 actionable tasks: 4 executed, 58 up-to-date

What would I not be doing rightly?

Other errors include

info Writing bundle output to:, D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle
info Writing sourcemap output to:, D:\react-native\******\android\app\build\intermediates\sourcemaps\react\release\index.android.bundle.packager.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 13 asset files
info Done copying assets
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:1769:18: warning: the variable "DebuggerInternal" was not declared in function "__shouldPauseOnThrow"
          typeof DebuggerInternal !== 'undefined' && DebuggerInternal.shouldPauseOnThrow === true
                 ^~~~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:4994:7: warning: the variable "setTimeout" was not declared in function "logCapturedError"
      setTimeout(function () {
      ^~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:3592:21: warning: the variable "clearTimeout" was not declared in anonymous function " 90#"
    cancelTimeout = clearTimeout;
                    ^~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:7492:30: warning: the variable "__REACT_DEVTOOLS_GLOBAL_HOOK__" was not declared in anonymous function " 90#"
  if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:7507:146: warning: the variable "nativeFabricUIManager" was not declared in anonymous function " 119#"
    null != handle._nativeTag && (null != handle._internalInstanceHandle ? (handle = handle._internalInstanceHandle.stateNode, null != handle && nativeFabricUIManager.dispatchCommand(handle.node, command, args)) : _$$_REQUIRE(_dependencyMap[2]).UIManager.dispatchViewManagerCommand(handle._nativeTag, command, args));
                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:8324:5: warning: the variable "setImmediate" was not declared in function "handleResolved"
    setImmediate(function () {
    ^~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:8540:16: warning: the variable "AggregateError" was not declared in function "getAggregateError"
    if (typeof AggregateError === 'function') {
               ^~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11456:12: warning: the variable "fetch" was not declared in anonymous function " 294#"
    fetch: fetch,
           ^~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11457:14: warning: the variable "Headers" was not declared in anonymous function " 294#"
    Headers: Headers,
             ^~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11458:14: warning: the variable "Request" was not declared in anonymous function " 294#"
    Request: Request,
             ^~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11459:15: warning: the variable "Response" was not declared in anonymous function " 294#"
    Response: Response
              ^~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11608:24: warning: the variable "FileReader" was not declared in function "readBlobAsArrayBuffer"
      var reader = new FileReader();
                       ^~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11645:36: warning: the variable "Blob" was not declared in anonymous function " 305#"
        } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
                                   ^~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11647:40: warning: the variable "FormData" was not declared in anonymous function " 305#"
        } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
                                       ^~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11649:44: warning: the variable "URLSearchParams" was not declared in anonymous function " 305#"
        } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
                                           ^~~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11877:23: warning: the variable "XMLHttpRequest" was not declared in anonymous function " 314#"
        var xhr = new XMLHttpRequest();
                      ^~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:11468:76: warning: the variable "self" was not declared in anonymous function " 297#"
    var global = typeof globalThis !== 'undefined' && globalThis || typeof self !== 'undefined' && self || typeof global !== 'undefined' && global;
                                                                           ^~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:19082:27: warning: the variable "performance" was not declared in anonymous function " 498#"
  if ("object" === typeof performance && "function" === typeof performance.now) {
                          ^~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:19105:26: warning: the variable "navigator" was not declared in anonymous function " 498#"
  "undefined" !== typeof navigator && undefined !== navigator.scheduling && undefined !== navigator.scheduling.isInputPending && navigator.scheduling.isInputPending.bind(navigator.scheduling);
                         ^~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:19172:37: warning: the variable "MessageChannel" was not declared in anonymous function " 498#"
  };else if ("undefined" !== typeof MessageChannel) {
                                    ^~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:26733:32: warning: the variable "requestAnimationFrame" was not declared in function "onUpdate"
        this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));
                               ^~~~~~~~~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:65200:7: warning: the property "alignItems" was set multiple times in the object definition.
      alignItems: 'center',
      ^~~~~~~~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:65199:7: note: The first definition was here.
      alignItems: 'flex-start',
      ^~~~~~~~~~~~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:65242:7: warning: the property "alignItems" was set multiple times in the object definition.
      alignItems: 'center',
      ^~~~~~~~~~~~~~~~~~~~
D:\react-native\******\android\app\build\generated\assets\react\release\index.android.bundle:65241:7: note: The first definition was here.
      alignItems: 'flex-end',
      ^~~~~~~~~~~~~~~~~~~~~~

Been searching out different things on the Internet, could not find anything that solves the issue. Seems React native has changed some things i do not seem to see why its giving this As an error.

Mike
  • 167
  • 2
  • 10
  • 1
    Does this answer your question? [React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0](https://stackoverflow.com/questions/74334162/react-native-android-build-failure-with-different-errors-without-any-changes-in) – Thanhal P A Nov 10 '22 at 09:42
  • @Thanhal, you said i should add it? in that buildscript area what do i add there – Mike Nov 10 '22 at 09:47
  • exclusiveContent object under repositories under allproject which you can see there in your file already. You can compare with your gradle, only that would be missing – Thanhal P A Nov 10 '22 at 09:49
  • @Thanhal you are a Blessing! Thank you very much! it builds fine now. So I just need to run gradlew bundleRelease for future builds correct? – Mike Nov 10 '22 at 09:58
  • You can do as like before. It's just react-native publish issue you can read it from here : https://github.com/facebook/react-native/issues/35210 – Thanhal P A Nov 10 '22 at 10:01
  • @Thanhal, thanks but it generated aab file. can people test with this, thinking it was squarely APK? – Mike Nov 10 '22 at 10:02

2 Answers2

2

android/build.gradle

comment this line

 maven {
            url("$rootDir/../node_modules/react-native/android")
        }

add

  exclusiveContent {

           filter {
               includeGroup "com.facebook.react"
           }

           forRepository {

               maven {
                   url "$rootDir/../node_modules/react-native/android"
               }

           }

       }

        mavenLocal()
0

add these lines into android/build.gradle File

allprojects {
    repositories {
        google()

         exclusiveContent {
           filter {
               includeGroup "com.facebook.react"
           }
           forRepository {
               maven {
                   url "$rootDir/../node_modules/react-native/android"
               }
           }
       }
       
       }