Imported module in Android Studio can't find imported class

前端 未结 7 1693
春和景丽
春和景丽 2020-12-28 12:33

I recently downloaded the ViewPagerIndicator library and imported it into android studio. After adding it to my project I get a rendering error \"The following classes could

相关标签:
7条回答
  • 2020-12-28 13:03

    First of all, you must import your library project by following that path:

    File --> New --> Import Module
    

    After you have imported the library project successfully, you must check your build.gradle file inside your project's folder if the following line is present at the "dependencies" section:

    implementation project(':NameOfTheLibProject')
    

    Then your project must be built successfully.

    0 讨论(0)
  • 2020-12-28 13:06

    The following solution worked for me,just two steps.

    Go to your project structure on android studio, select project from left side.Change Android plugin version to Gradle version press ok.

    If error occurs after synchronization again go to project structure and select project.undo the android plugin version like before.Gradle will align the library and make the class visible to XML files.

    0 讨论(0)
  • 2020-12-28 13:07

    I found that my issue was the Android Plugin Version under Project Structure --> Project was different to the version my plugins all used. Once I aligned them to the same version, I could see all my classes from my imported module.

    Took me hours :(

    0 讨论(0)
  • 2020-12-28 13:07

    I too had trouble importing module as it was not appearing in list of modules. And way it worked for me is manually entering it in settings.gradle this way:

    include ':app', 'module_name'
    

    And in build.gradle

    compile project(':module_name')
    
    0 讨论(0)
  • 2020-12-28 13:07

    The issue in my case was different compile and target SDK version, mentioned in my main app module and your added lib module. Once I matched both of them it worked perfectly. So just open build.gradle file of app-level and lib module-level check for the SDK version.

    0 讨论(0)
  • 2020-12-28 13:15

    I had the same problem. I just did: Invalidate / Restart ..

    0 讨论(0)
提交回复
热议问题