无法解析符号'CalligraphyContextWrapper'

3
直到昨天一切都很正常,但今天我将我的Android Studio2.3升级到3.1,现在出现了这个错误。尽管我仍然得到Cannot resolve symbol CalligraphyContextWrapper的提示,但项目成功地进行了cleanbuild,并且font也能够正常更改。如果一切正常,为什么还会出现这个错误,让我感到惊讶。您可以在图像中看到错误,并且我还添加了我的gradle代码。请告诉我是否有做错什么。

enter image description here

build.grade:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "com.package"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation  'com.android.support:appcompat-v7:27.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:design:27.0.0'
    implementation 'com.android.support:cardview-v7:27.0.0'
    /* Retrofit */
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    implementation 'com.google.code.gson:gson:2.7'
    implementation 'com.squareup.okhttp3:okhttp:3.4.2'
    //multi dex
    implementation 'com.android.support:multidex:1.0.1'
    //Picasso
    implementation 'com.squareup.picasso:picasso:2.5.2'
    //Buimplementationtter knife
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    //planet payment gateway
    implementation 'com.google.android.gms:play-services-wallet:11.0.4'
    //font
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'io.card:android-sdk:5.5.1'
}

我也在Github上提出了这个问题,但是Calligraphy团队没有回应。 https://github.com/chrisjenx/Calligraphy/issues/449#issuecomment-386390551 任何帮助或线索都将不胜感激。

1
我使用了 calligraphy:2.2.0 - IntelliJ Amiya
1
@IntelliJAmiya 谢谢。它像魔法一样奏效了。为什么会发生这种情况呢? - Däñish Shärmà
1
不知道确切的原因,但这里运行良好。可能是系统层面的问题。 - IntelliJ Amiya
2个回答

4

您可以降级版本。使用2.2.0代替2.3.0

implementation 'uk.co.chrisjenx:calligraphy:2.2.0'

然后执行Clean-Rebuild-Run操作。

2

我不确定是否相关,但我通过以下方式解决了类似问题;

  1. 从gradle构建文件中删除依赖项
  2. 同步gradle文件
  3. 再次添加相同的依赖项并进行同步。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接