plaid-link-android icon indicating copy to clipboard operation
plaid-link-android copied to clipboard

code doesn't recognize link classes

Open SavedByZero opened this issue 3 years ago • 3 comments

The problem

even with the dependency loaded in the app gradle file, Link classes are "unable to resolve"

Environment

Android Studio 4.1, Windows PC

Steps to Reproduce

-add implementation "com.plaid.link:sdk-core:3.7.1" to app gradle file -make a java class inside app/src/main -import classes like: import com.plaid.link.OpenPlaidLink; import com.plaid.link.Plaid; . -none of them are recognized.

here is my app gradle build file:

`plugins { id 'com.android.application' id 'kotlin-android' }

android { compileSdkVersion 31 buildToolsVersion "30.0.2"

defaultConfig {
    applicationId "com.example.plaidlinkplugin"
    minSdkVersion 21
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"


}

buildTypes {
    release {
        minifyEnabled false

    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}

}

dependencies { implementation ("com.plaid.link:sdk-core:3.7.1") {

}

implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}`

and here is my root gradle build file: `// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = "1.5.10" repositories { google() jcenter() mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:4.1.0" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects { repositories { google() jcenter() mavenCentral() } }

task clean(type: Delete) { delete rootProject.buildDir }`

SavedByZero avatar Mar 14 '22 22:03 SavedByZero

Hi does this issue repro with our public sample (in this repo)? We have Java classes to ensure compatibility: https://github.com/plaid/plaid-link-android/blob/master/app/src/main/java/com/plaid/linksample/MainActivityStartActivityForResultJava.java

amytang0 avatar Mar 17 '22 18:03 amytang0

Correct. I cloned the project as well to make sure, and I get the same unresolved packages without anything being changed. Here's a screen shot of that last class file you linked to. EDIT: It seems to actually happen in the ks files and the Java files, and sometimes it alternates. image

SavedByZero avatar Mar 17 '22 20:03 SavedByZero

Are you able to build via command line? You can verify that by running ./gradlew assembleDebug. If that passes, that would indicate this is an Android Studio issue.

To fix the Android Studio issue:

  • Try invalidate caches & restart in Android Studio
  • If that doesn't work, delete the .idea folder in your project
  • If that doesn't work, delete the .gradle folder in your user home: rm -rf ~/.gradle

Hope those steps will help!

JeroenMols avatar Mar 24 '22 08:03 JeroenMols