BranchMetrics / capacitor-branch-deep-links

Capacitor plugin for branch.io deep links
MIT License
33 stars 43 forks source link

Plugin incompatible with Gradle 8 #109

Closed anandsathe67 closed 10 months ago

anandsathe67 commented 11 months ago

Describe the bug

As part of the Capacitor 5 upgrade, I switched my Android setup to use Gradle 8. Am unable to compile the project due to incompatibility of this plugin with gradle 8 (works fine with gradle 7.x)

Steps to reproduce

  1. Specify gradle 8.0.2 in build.gradle
  2. Try to build your project which uses this plugin
  3. The following error is seen in the build log Seeing this in the log while building my project: `A problem occurred configuring project ':capacitor-branch-deep-links'.

    defaultConfig contains custom BuildConfig fields, but the feature is disabled.

Expected behavior

The project should build without any errors

SDK Version

5.0.0

Make and Model

Oppo A74

OS

Android 13

Additional Information/Context

Using Android Studio Flamingo | 2022.2.1 Patch 2

nvahalik commented 11 months ago

@anandsathe67 We have been able to get this running (at least so far) successfully in Capacitor 5 for both iOS and Android using our repo here:

https://github.com/1stphorm/capacitor-branch-deep-links/tree/cap-5-branch-sdk

To try it out, you can run:

npm i https://github.com/1stphorm/capacitor-branch-deep-links\#cap-5-branch-sdk

This branch also updates from the original Branch module for iOS to use the new BranchSDK module.

avisiboni commented 11 months ago

@nvahalik I tried your suggestion, and receive the following error:

image

I'll appreciate your help, thanks!

nvahalik commented 11 months ago

Not sure why it is doing SSH... That seems like an NPM problem perhaps?

anandsathe67 commented 11 months ago

Here is the patch I had to use to make it work with gradle 8 (added namespace, remove custom build config). Something to do with the fact i am using Branch as opposed to BranchSDK ?? Not sure

diff --git a/node_modules/capacitor-branch-deep-links/android/build.gradle b/node_modules/capacitor-branch-deep-links/android/build.gradle
index 85ae5be..524f9fa 100644
--- a/node_modules/capacitor-branch-deep-links/android/build.gradle
+++ b/node_modules/capacitor-branch-deep-links/android/build.gradle
@@ -25,6 +25,7 @@ buildscript {
 apply plugin: 'com.android.library'

 android {
+    namespace "co.boundstate.capacitorbranchdeeplinks"
     compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
     defaultConfig {
         minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
@@ -32,7 +33,6 @@ android {
         versionCode 1
         versionName "1.0"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-        buildConfigField("String", "CAPACITOR_BRANCH_VERSION", "\"${getNpmVersion()}\"")
     }
     buildTypes {
         release {

diff --git a/node_modules/capacitor-branch-deep-links/android/src/main/AndroidManifest.xml b/node_modules/capacitor-branch-deep-links/android/src/main/AndroidManifest.xml
index 4c290b0..e546d9a 100644
--- a/node_modules/capacitor-branch-deep-links/android/src/main/AndroidManifest.xml
+++ b/node_modules/capacitor-branch-deep-links/android/src/main/AndroidManifest.xml
@@ -1,5 +1,5 @@

   <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="co.boundstate.capacitorbranchdeeplinks">
+      >
   </manifest>

\ No newline at end of file
diff --git a/node_modules/capacitor-branch-deep-links/android/src/main/java/co/boundstate/BranchDeepLinks.java b/node_modules/capacitor-branch-deep-links/android/src/main/java/co/boundstate/BranchDeepLinks.java
index 464980a..bc45c72 100644
--- a/node_modules/capacitor-branch-deep-links/android/src/main/java/co/boundstate/BranchDeepLinks.java
+++ b/node_modules/capacitor-branch-deep-links/android/src/main/java/co/boundstate/BranchDeepLinks.java
@@ -6,7 +6,7 @@ import android.net.Uri;
 import android.os.UserManager;
 import android.util.Base64;
 import androidx.annotation.NonNull;
-import co.boundstate.capacitorbranchdeeplinks.BuildConfig;
+import co.boundstate.capacitorbranchdeeplinks.*;
 import com.getcapacitor.JSArray;
 import com.getcapacitor.JSObject;
 import com.getcapacitor.Plugin;
@@ -40,7 +40,7 @@ public class BranchDeepLinks extends Plugin {
     private static final String EVENT_INIT_ERROR = "initError";

     public static Branch getBranchInstance(@NonNull Context context) {
-        Branch.registerPlugin("Capacitor", BuildConfig.CAPACITOR_BRANCH_VERSION);
+        Branch.registerPlugin("Capacitor", "5.0.0");

         boolean isUnlocked = isUserUnlocked(context);
gdeluna-branch commented 11 months ago

We'll be updating our plugin to cap 5 as well as updating to gradle 8. Will close this out as soon as we have it published.

GiannisS commented 10 months ago

We'll be updating our plugin to cap 5 as well as updating to gradle 8. Will close this out as soon as we have it published.

@gdeluna-branch Thanks for the feedback. Is there an ETA for this?

gdeluna-branch commented 10 months ago

We expect by this Friday, pending testing.

gdeluna-branch commented 10 months ago

Please test capacitor 5 with this Branch Capacitor beta package https://www.npmjs.com/package/capacitor-branch-deep-links/v/6.0.0-beta.0

For iOS you will need to import BranchSDK instead of Branch. There should not be any other code changes needed for Android.

Let me know if this package works out, we'll release proper next week with documentation updates.

anandsathe67 commented 10 months ago

Hello, Do you think it might make sense to use the latest gradle (8.2) ? Might as well be on the latest version if we are releasing it now Regards Anand

On Sat, Jul 1, 2023 at 3:48 AM gdeluna-branch @.***> wrote:

Please test capacitor 5 with this Branch Capacitor beta package https://www.npmjs.com/package/capacitor-branch-deep-links/v/6.0.0-beta.0

For iOS you will need to import BranchSDK instead of Branch. There should not be any other code changes needed for Android.

Let me know if this package works out, we'll release proper next week with documentation updates.

— Reply to this email directly, view it on GitHub https://github.com/BranchMetrics/capacitor-branch-deep-links/issues/109#issuecomment-1615240072, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIMGQAURFSMFANK4HPV6FLXN5GC3ANCNFSM6AAAAAAZDS6TWE . You are receiving this because you were mentioned.Message ID: @.*** com>

gdeluna-branch commented 10 months ago

Published https://www.npmjs.com/package/capacitor-branch-deep-links/v/6.0.0 https://github.com/BranchMetrics/capacitor-branch-deep-links/releases/tag/v6.0.0