React-native-branch-deep-linking-attribution: Can't install Android app after upgrading to 2.0.0

Created on 1 Sep 2017  路  13Comments  路  Source: BranchMetrics/react-native-branch-deep-linking-attribution

Hello, I believe that I followed the upgrade instructions properly but I am unable to run the Android project now with the new 2.0.0 SDK. I get this in the Android Studio Messages panel when I try to run the project.

Information:Gradle tasks [:app:assembleDebug]
Warning:string 'catalyst_debugjs' has no default translation.
Warning:string 'catalyst_element_inspector' has no default translation.
Warning:string 'catalyst_jsload_error' has no default translation.
Warning:string 'catalyst_jsload_message' has no default translation.
Warning:string 'catalyst_jsload_title' has no default translation.
Warning:string 'catalyst_reloadjs' has no default translation.
Warning:string 'catalyst_settings' has no default translation.
Warning:string 'catalyst_settings_title' has no default translation.
Warning:string 'catalyst_debugjs' has no default translation.
Warning:string 'catalyst_element_inspector' has no default translation.
Warning:string 'catalyst_jsload_error' has no default translation.
Warning:string 'catalyst_jsload_message' has no default translation.
Warning:string 'catalyst_jsload_title' has no default translation.
Warning:string 'catalyst_reloadjs' has no default translation.
Warning:string 'catalyst_settings' has no default translation.
Warning:string 'catalyst_settings_title' has no default translation.
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.builders.Indexables
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.FirebaseAppIndex
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.Indexable
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.FirebaseAppIndex
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.Action$Builder
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.Action$Metadata$Builder
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.Action$Builder
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.FirebaseUserActions
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.builders.Indexables
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.FirebaseAppIndex
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.Action
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.Action$Metadata
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.FirebaseUserActions
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.Indexable
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.Action
Warning:io.branch.indexing.AppIndexingHelper: can't find referenced class com.google.firebase.appindexing.FirebaseUserActions
Warning:io.branch.indexing.AppIndexingHelper$1: can't find referenced class com.google.firebase.appindexing.FirebaseUserActions
Warning:io.branch.indexing.AppIndexingHelper$2: can't find referenced class com.google.firebase.appindexing.FirebaseAppIndex
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEvent
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.AnswersOptionalLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEventLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.AnswersOptionalLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEventLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEvent
Warning:there were 44 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug'.
> Job failed, see logs for details
Information:BUILD FAILED
Information:Total time: 23.86 secs
Information:1 error
Information:42 warnings
Information:See complete output in console

iOS works just fine and I was able to use the newly exposed sendCommerceEvent method. Thanks for that one.

Any help you could provide on this would be much appreciated.

Most helpful comment

I started to get the similar warnings suddenly when using proguard.
However, the issue got fixed as soon as I added
-dontwarn io.branch.**

The branch sdk is used as a gradle dependency in our project
compile('io.branch.sdk.android:library:2.+') { exclude module: 'answers-shim' }

How do we resolve such issues which appear suddenly? Should I restrict to use a particular version of branch sdk rather than using '2.+' in the gradle dependency?

All 13 comments

Hi @jasonmerino. Which version were you using before? If this was working with the 2.0.0 beta, I'm not sure what would have changed. If you're upgrading from < 2.0.0, please see https://github.com/BranchMetrics/react-native-branch-deep-linking#updating-from-an-earlier-version.

Are you using the package from NPM or a URL (e.g. from the git repo)? If you install using a URL, I think you get the whole file tree installed under node_modules, and you may need to add something like this to your app/build.gradle:

project.ext.react = [
    inputExcludes = [
        "android/**", 
        "ios/**",
        "node_modules/react-native-branch/examples/**",
        "node_modules/react-native-branch/native-sdks/**",
        "node_modules/react-native-branch/native-tests/**"
    ]
]

I'm able to run the assembleDebug task fine in the webview_example. That might give you some hints.

@jdee

Our previous version was set to ~1.1.1. I think I followed the upgrading from an earlier version information. I see that that guide references removing compile 'io.branch.sdk.android:library:2.+', but we didn't have that in our app/build.gradle file.

We are using the package from NPM which is now set to 2.0.0, so it sounds like I should need any other excludes in our app/build.gradle.

My coworker directed me to put a -dontwarn io.branch.** in our proguard-rules.pro file and that showed that we needed to change our application to multidex. I was able to get it running, but then I tried to do some clean up and broke it again... It seems like the warnings and that error that I posted above were just masking the multidex issue and I needed to not warn for the branch module in pro-guard to even see that.

I _think_ I have it fixed. Now I just need to wait and see when gradle finishes doing its thing.

Hi @jasonmerino. Hopefully your fix worked.

You only need to add those excludes to the build.gradle if you're packaging an APK using react-native-branch from a URL (file: or git repo). When building a release for NPM, the package files are whitelisted in package.json.

Closing this. Feel free to reopen if you haven't gotten past this.

@jdee once we added the -dontwarn to proguard and multi-dexed the app then it worked. So we are good to go! Thanks!

My project was working for assembleRelease for all 2.0.0 beta versions, but I got the same problem once I upgraded to the actual 2.0.0 release

@jasonmerino Glad you got it fixed. Maybe that will help @wildseansy as well.

I'm surprised that this behavior changed between 2.0.0 beta and the prod release. The only thing that changed in that regard was the version of the Android SDK. Can anyone put their finger on exactly the version where this changed? One thing that happened in the RCs was automation of the native SDK update process. This is pretty involved for iOS. For Android, it is just a matter of copying a jar and modifying the android/build.gradle file in the repo to use the new version.

As mentioned before, when installing from a URL, the entire repo is copied under node_modules, so there are sometimes issues with the React Packager in that mode that you have to work around using the Gradle modification mentioned above. But I know that doesn't apply to @jasonmerino, so at least it's not the whole story.

A question @jasonmerino @wildseansy: Are you using yarn or npm to install dependencies? That difference has had some small effects in the past.

@jdee I'm using NPM for this project, although I do have yarn installed on my machine for other projects. But I've not used yarn for this project where I was having the issue.

Adding the -dontwarn io.branch.** to proguard fixed it for me. I use yarn.

Thanks @jasonmerino, @wildseansy. That was a stab in the dark. I don't think npm/yarn has anything to do with it. I think the proguard patch is the right answer. Note from the default proguard-rules.pro for a RN project:

-dontwarn com.facebook.react.**

I have a feeling that applies to any jar taken from node_modules, but I'm not sure. That might explain why this happens for Branch, at any rate. The README needs an update.

I started to get the similar warnings suddenly when using proguard.
However, the issue got fixed as soon as I added
-dontwarn io.branch.**

The branch sdk is used as a gradle dependency in our project
compile('io.branch.sdk.android:library:2.+') { exclude module: 'answers-shim' }

How do we resolve such issues which appear suddenly? Should I restrict to use a particular version of branch sdk rather than using '2.+' in the gradle dependency?

@ankitmaheswari Looking at the change log it seems the last version (v2.12.0) adds support for Firebase. I restricted my Branch version to the previous one (v2.11.1) to fix the issue.

@ankitmaheswari @adrian-ledge Release 2.0.0 of react-native-branch includes the native SDKs. They are intended to be taken from the NPM package, not from Maven, CocoaPods, etc. Please see https://github.com/BranchMetrics/react-native-branch-deep-linking#updating-from-an-earlier-version.

I don't recommend taking the Branch SDK from Maven here, and that can definitely cause complaints about duplicate classes, since there is a jar in the NPM module.

I'm not sure why you'd want to avoid a new version because it introduces support for Firebase. That was added as an optional dependency. But see also this issue comment: https://github.com/BranchMetrics/android-branch-deep-linking/issues/476#issuecomment-329571118.

Was this page helpful?
0 / 5 - 0 ratings