外部库:无法解析符号

时间:2015-12-26 18:32:03

标签: android import external

我在我的应用中使用BetterSpinner

我只是简单地把它包括在内:

compile 'com.weiwangcn.betterspinner:library-material:1.1.0'

当我尝试使用它时,Android Studio甚至不建议导入库并将BetterSpinner标记为红色:

enter image description here

代码:

BetterSpinner textView = (BetterSpinner)
                findViewById(R.id.registration_spinner_stufe);
        textView.setAdapter(adapter);

Android Studio没有将BetterSpinner库导入我的Fragment类的错误在哪里?

解决方案

  

"文件" - > "使缓存无效......" - > "无效并重新启动"

对我不起作用..

import com.weiwangcn.betterspinner.library.BetterSpinner;
import com.weiwangcn.betterspinner.library.material.MaterialBetterSpinner;

被Android Studio忽略:

enter image description here

我的完整成绩档案:

[应用]

  apply plugin: 'com.android.application'

    android {
        compileSdkVersion 23
        buildToolsVersion '23.0.2'
        defaultConfig {
            applicationId "com.example.jublikon"
            minSdkVersion 21
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        sourceSets {
            main { res.srcDirs = ['src/main/res', 'src/main/res/drawable/ic_action_search.png'] }
        }
        productFlavors {
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        //Google Libraries
        compile 'com.android.support:appcompat-v7:23.0.+'
        compile 'com.android.support:recyclerview-v7:23.0.+'
        compile 'com.android.support:cardview-v7:23.0.+'
        compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
        compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
        compile 'com.github.paolorotolo:appintro:3.3.0'
        compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
    }

[项目]

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:+'

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

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://jitpack.io"
        }
        mavenCentral()
    }
    repositories {
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
}

0 个答案:

没有答案