tschoffelen / react-native-email-link

πŸ“­ Open an email client from React Native (for 'magic link' type functionality).
MIT License
412 stars 74 forks source link

[Android] Build "Failed to create MD5 hash for file content" with RN 0.66 / Gradle plugin 4.2.2 #97

Closed ponomarevv closed 7 months ago

ponomarevv commented 3 years ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Looks like there is an issue with latest RN version (it was fixed when I updated gradle plugin version to be the same as in RN itself)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':react-native-email-link'.
> Failed to create MD5 hash for file content.

I used patch-package to patch react-native-email-link@1.12.2, here is the diff that solved my problem:

diff --git a/node_modules/react-native-email-link/android/build.gradle b/node_modules/react-native-email-link/android/build.gradle
index ebf3948..10bd447 100755
--- a/node_modules/react-native-email-link/android/build.gradle
+++ b/node_modules/react-native-email-link/android/build.gradle
@@ -19,11 +19,11 @@ def safeExtGet(prop, fallback) {

 buildscript {
     ext {
-        minSdkVersion = 16
-        compileSdkVersion = 29
-        targetSdkVersion = 29
-        gradlePluginVersion = "3.5.1"
+        minSdkVersion = rootProject.ext.has("minSdkVersion") ? rootProject.ext.get("minSdkVersion") : 16
+        compileSdkVersion = rootProject.ext.has("compileSdkVersion") ? rootProject.ext.get("compileSdkVersion") : 29
+        targetSdkVersion = rootProject.ext.has("targetSdkVersion") ? rootProject.ext.get("targetSdkVersion") : 29
         reactNativeVersion = "+" // The react native versioning on jcenter is messed up: https://github.com/facebook/react-native/issues/13094
+        gradlePluginVersion = rootProject.ext.has("gradlePluginVersion") ? rootProject.ext.get("gradlePluginVersion") : "3.5.1"
     }

     repositories {

also i added gradlePluginVersion variable to the root project build.gradle ext

This issue body was partially generated by patch-package.

tschoffelen commented 3 years ago

Hi @ponomarevv, thanks for that! Would you be able to open a PR with these changes? Happy to accept them!

github-actions[bot] commented 7 months ago

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] commented 7 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale. Please feel free to re-open if you feel this issue is still relevant.