plaid / plaid-link-android

Plaid Link Android SDK
https://plaid.com/docs/link/android
MIT License
115 stars 48 forks source link

When every i add implementation'com.plaid.link:sdk-core:2.1.0' in android project i get error #87

Closed naimishmodi39 closed 4 years ago

naimishmodi39 commented 4 years ago

error: cannot access HasFragmentInjector public abstract class BaseActivity<T extends ViewDataBinding, V extends BaseViewModel> extends DaggerAppCompatActivity implements HasSupportFragmentInjector,BaseFragment.Callback, UtilClass.AlertMenuListener { ^ class file for dagger.android.HasFragmentInjector not found

in any android project in java language that use dependency injection have the issue after adding this library

amytang0 commented 4 years ago

Hi Naimish, What version of link-sdk are you using? Can you also include your Dagger Gradle dependency?

Thank you! Amy

naimishmodi39 commented 4 years ago

Hi Amy, Thank you for reply This are the Dagger library and annotationProcessor that i use

implementation'com.plaid.link:sdk-core:2.1.0'

implementation 'com.google.dagger:dagger:2.21' annotationProcessor 'com.google.dagger:dagger-compiler:2.21' implementation 'com.google.dagger:dagger-android-support:2.21' annotationProcessor 'com.google.dagger:dagger-android-processor:2.21'

Android Studio 4.0.1 Gradle 3.6.3 minSdkVersion 21 targetSdkVersion 29 compileSdkVersion 29 buildToolsVersion "29.0.3"

compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }

dataBinding {
    enabled true
}
amytang0 commented 4 years ago

Interesting, so I tried to replicate the issue with the provided dependencies in a sample project and did not run across this error. How are you using Dagger in your project/ where are you injecting?

naimishmodi39 commented 4 years ago

try this demo project to replicate the issue

https://github.com/MindorksOpenSource/android-mvvm-architecture

amytang0 commented 4 years ago

Thank you for providing the sample project. So dagger.android.HasFragmentInjectordoes not exist in 2.24, but does exist in the sample Mindorks project you sent me: 2.16 and 2.21, the version you are using. Internally, Plaid is currently using 2.27, so when you pulled in the Plaid Link SDK, it was also pulling in the 2.27 Dagger2 dependency (which uses HasAndroidInjector instead).

You have two possible solutions:

  1. Upgrade to Dagger2:2.24+
  2. Pull in the Plaid library without the Dagger dependency like:
    implementation("com.plaid.link:sdk-core:2.1.0") {
        exclude group:  "com.google.dagger", module: "dagger-android"
    }

Let me know if that fixes your issue!

amytang0 commented 4 years ago

Closing after 30 days of inactivity