Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Conversation

@mrbrentkelly
Copy link
Contributor

Overview

Fixes an issue when building and running instrumented tests (e.g. Detox) for a React Native project on Android, the following build error was occurring:

> Task :react-native-push-notification:mergeExtDexDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-push-notification:mergeExtDexDebugAndroidTest'.
> Could not resolve all files for configuration ':react-native-push-notification:debugAndroidTestRuntimeClasspath'.
   > Failed to transform firebase-datatransport-18.0.0.aar (com.google.firebase:firebase-datatransport:18.0.0) to match attributes {artifactType=android-dex, dexing-enable-desugaring=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: C:\Users\some-user\.gradle\caches\transforms-2\files-2.1\4d61182c30ea6157b57a4d6f697f3dae\firebase-datatransport-18.0.0-runtime.jar.
         > Error while dexing.
           The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle
           android {
               compileOptions {
                   sourceCompatibility 1.8
                   targetCompatibility 1.8
               }
           }
           See https://developer.android.com/studio/write/java8-support.html for details. Alternatively, increase the minSdkVersion to 26 or above.

If an Android library uses Java 8 language features then it must declare compileOptions in its build.gradle.

...each module that uses Java 8 language features (either in its source code or through dependencies), update the module's build.gradle file, as shown below:

https://developer.android.com/studio/write/java8-support#supported_features

Fix is simply to add Java 8 compileOptions to the build.gradle. I've seen and fixed similar issues in other projects as well:

negativetwelve/react-native-ux-cam#104
react-native-netinfo/react-native-netinfo#466
snowplow/snowplow-react-native-tracker#117

Test Plan

Made the change locally in my projects node_modules, then rebuilt the app, and it was successful 🎉 .

@Dallas62 Dallas62 changed the base branch from master to dev May 13, 2021 09:56
@Dallas62 Dallas62 merged commit 60f7eba into zo0r:dev May 13, 2021
@Dallas62
Copy link
Collaborator

Thanks for your contribution !
This will be release in the next version

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants