简体   繁体   中英

Issues importing an external library from github from Android Studio

I have been having issues importing this library into my project in Android studio. It defines a new type of ImageView to make it easier to add pins to images as well as perform pinch zoom operations. I'm facing the issue where I can't refer to the particular class (SubsamplingScaleImageView) in my code. In the code file that I'm trying to refer to it, I've tried importing the same path as defined for the layout xml file, but it still gives an error of the class identifier being invalid. My gradle version is 1.2.2. As per the instructions in the repo, I tried just adding the compile directive to my app's build.gradle file, also downloading the aar file directly and importing it into my project. In both cases, the project will build correctly, but in the specific files where I want to refer to the control, I'll get an error. In the layout xml file where I want to use it, I've used the correct identifier (as defined here ) and defined the correct namespace in the file to get the proper attributes.

I've been wrestling with this problem for a lot longer then I'd care to admit and would appreciate any help at all

Try:

Go to File > Invalidate Cache/Restart > Invalidate and Restart

or try: Updating Gradle (since the library uses gradle 3.0.1) as:

 dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
}

or update your Android Studio to the latest version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM