NoSuchMethodError:没有静态方法getFont

时间:2019-04-21 09:36:15

标签: android unity3d gradle

我总是遇到错误。
我在Google中找到了一些参考。许多人说将compileSdkVersion更新为27,将buildToolsVersion更新为27.0.3,将targetSdkVersion更新为27。
还有
有人还说appcompatrecyclerview版本不相同。但是我可以确保这两个文件的版本相同。

  
    

java.lang.NoSuchMethodError:没有静态方法getFont(Landroid / content / Context; ILandroid / util / TypedValue; ILandroid / support / v4 / content / res / ResourcesCompat $ FontCallback;)Landroid / graphics / Typeface;在类Landroid / support / v4 / content / res / ResourcesCompat中;或其超级类(“ android.support.v4.content.res.ResourcesCompat”的声明显示在/data/app/com.animocabrands.google.beastquesttd-lP4j-41R8T8tb4W2OwS-LQ==/base.apk)                                                          在android.support.v7.widget.TintTypedArray.getFont(未知来源:18)                                                          在android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(未知来源:78)                                                          在android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(未知来源:179)                                                          在android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(未知来源:1)                                                          位于android.support.v7.widget.AppCompatTextView。(未知来源:27)                                                          位于android.support.v7.widget.AppCompatTextView。(未知来源:3)                                                          位于android.support.v7.widget.AppCompatTextView。(未知来源:1)                                                          在android.support.v7.widget.Toolbar.setTitle(未知来源:42)                                                          在android.support.v7.widget.ToolbarWidgetWrapper.setTitleInt(未知来源:11)                                                          在android.support.v7.widget.ToolbarWidgetWrapper.setWindowTitle(未知来源:5)                                                          位于android.support.v7.app.ToolbarActionBar。(未知来源:53)                                                          在android.support.v7.app.AppCompatDelegateImplV9.setSupportActionBar(未知来源:60)                                                          在android.support.v7.app.AppCompatActivity.setSupportActionBar(未知来源:4)                                                          在com.helpshift.support.activities.ParentActivity.onCreate(ParentActivity.java:28)                                                          在android.app.Activity.performCreate(Activity.java:6986)                                                          在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1232)                                                          在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2857)                                                          在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2979)                                                          在android.app.ActivityThread.-wrap11(未知来源:0)                                                          在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1643)                                                          在android.os.Handler.dispatchMessage(Handler.java:105)                                                          在android.os.Looper.loop(Looper.java:180)                                                          在android.app.ActivityThread.main(ActivityThread.java:6944)                                                          在java.lang.reflect.Method.invoke(本机方法)                                                          在com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:240)                                                          在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:853)

  


这是我的gradle文件。

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
    repositories {
//      google()
        jcenter()
    }

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

allprojects {
   repositories {
        flatDir {
            dirs 'libs'
        }
       maven {
           url 'https://maven.google.com'
       }
   }
}

apply plugin: 'com.android.application'

android {
    configurations.all {
        resolutionStrategy.force 'com.android.support:multidex:1.0.3'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':fabric-init')
    compile project(':fabric')
    compile project(':crashlytics')
    compile project(':crashlytics-wrapper')
    compile project(':answers')
    compile project(':beta')
    compile project(':OneSignalConfig')
    compile project(':SuperAwesome_lib')
    compile project(':unity-android-resources')
    compile files('libs/unity-classes.jar')
    compile(name: 'common', ext: 'aar')
    compile(name: 'GoogleAIDL', ext: 'aar')
    compile(name: 'GooglePlay', ext: 'aar')
    compile(name: 'Helpshift', ext: 'aar')
    compile(name: 'com.android.support.animated-vector-drawable-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.appcompat-v7-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.cardview-v7-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.customtabs-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.design-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.recyclerview-v7-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-compat-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-core-ui-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-core-utils-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-fragment-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-media-compat-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-v4-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-vector-drawable-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.transition-27.1.1', ext: 'aar')
    compile(name: 'android.arch.core.runtime-1.1.0', ext: 'aar')
    compile(name: 'android.arch.lifecycle.livedata-core-1.1.0', ext: 'aar')
    compile(name: 'android.arch.lifecycle.runtime-1.1.0', ext: 'aar')
    compile(name: 'android.arch.lifecycle.viewmodel-1.1.0', ext: 'aar')
    compile(name: 'UnityAds', ext: 'aar')
    compile(name: 'flurry-analytics', ext: 'aar')
    compile(name: 'com.google.android.gms.play-services-ads-identifier-16.0.0', ext: 'aar')
    compile(name: 'com.google.android.gms.play-services-base-16.1.0', ext: 'aar')
    compile(name: 'com.google.android.gms.play-services-basement-16.2.0', ext: 'aar')
    compile(name: 'com.google.android.gms.play-services-iid-12.0.1', ext: 'aar')
    compile(name: 'com.google.android.gms.play-services-location-16.0.0', ext: 'aar')
    compile(name: 'com.google.android.gms.play-services-places-placereport-16.0.0', ext: 'aar')
    compile(name: 'com.google.android.gms.play-services-stats-16.0.1', ext: 'aar')
    compile(name: 'com.google.android.gms.play-services-tasks-16.0.1', ext: 'aar')
    compile(name: 'com.google.firebase.firebase-common-16.1.0', ext: 'aar')
    compile(name: 'com.google.firebase.firebase-iid-17.1.2', ext: 'aar')
    compile(name: 'com.google.firebase.firebase-iid-interop-16.0.1', ext: 'aar')
    compile(name: 'com.google.firebase.firebase-measurement-connector-17.0.1', ext: 'aar')
    compile(name: 'com.google.firebase.firebase-messaging-17.6.0', ext: 'aar')
    compile(name: 'installreferrer-1.0', ext: 'aar')
    compile(name: 'onesignal-unity', ext: 'aar')
    compile(name: 'gameanalytics', ext: 'aar')
}

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        targetSdkVersion 27
        applicationId 'xxxxx'
        multiDexEnabled true
        versionCode 43
        versionName "1.0.32"
        minSdkVersion 16
        jackOptions {
            enabled true
        }
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress '.unity3d', '.ress', '.resource', '.obb'
    }

    dexOptions{
        javaMaxHeapSize "2g"
    }

    signingConfigs {
        release {
            storeFile file("xxxxx")
            storePassword 'xx'
            keyAlias 'xxxx'
            keyPassword 'xxxx'
        }
    }

    buildTypes {
        debug {
            jniDebuggable true
        }
        release {
            // Set minifyEnabled to true if you want to run ProGuard on your project
            // minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
            signingConfig signingConfigs.release
            multiDexKeepFile file('multidex-config.txt')
        }
    }

    compileOptions{
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}


请帮忙。谢谢。

0 个答案:

没有答案