gpt4 book ai didi

android - java.lang.NoSuchMethodError : No static method getDrawable(Landroid/content/Context;I) 错误

转载 作者:行者123 更新时间:2023-11-29 19:13:12 27 4
gpt4 key购买 nike

正在将 Socialize SDK 集成到我的应用程序中。我还将我的 Android Studio 更新到 2.3.3。我的 Activity 的 super.onCreate(savedInstanceState) 给我一个错误。这里也提出了同样的问题'java.lang.NoSuchMethodError: No static method getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable; '.但这对我没有帮助,因为我的 libs 文件夹下没有任何 jar 文件。

--------- beginning of crash
06-12 16:07:41.954 16968-16968/com.jeyashri.kitchen.jeyashriskitchen E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.jeyashri.kitchen.jeyashriskitchen, PID: 16968
java.lang.NoSuchMethodError: No static method getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable; in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/app/com.jeyashri.kitchen.jeyashriskitchen-1/base.apk:classes8.dex)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:201)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:189)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:710)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:194)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:129)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:152)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:29)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegateImplV23.<init>(AppCompatDelegateImplV23.java:31)
at android.support.v7.app.AppCompatDelegateImplN.<init>(AppCompatDelegateImplN.java:31)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:200)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:184)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:518)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:70)
at com.jeyashri.kitchen.jeyashriskitchen.Activity.MainActivity.onCreate(MainActivity.java:60)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

下面是我的 gradle 文件。

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.jeyashri.kitchen.jeyashriskitchen"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java', 'src/main/java/com.jeyashri.kitchen.jeyashrikitchen.Fragments', 'src/main/java/Fragements']
}
}
}

android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//compile 'com.android.support:appcompat-v7:25.3.1'
//compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.socialize:facebook:3.1.6'
compile 'com.socialize:ioc:3.1.6'
compile 'com.socialize:loopy:3.1.7'
compile 'com.socialize:library:3.1.7'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.apis:google-api-services-youtube:v3-rev176-1.22.0'
//compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.0.0-alpha1'
}

只有当我在 gradle 中添加以下文件时才会出现此问题。否则应用程序运行时不会崩溃。

    compile 'com.socialize:facebook:3.1.6'
compile 'com.socialize:ioc:3.1.6'
compile 'com.socialize:loopy:3.1.7'
compile 'com.socialize:library:3.1.7'

最佳答案

升级您的 gms:play-services 版本。

不要

compile 'com.google.android.gms:play-services-ads:8.4.0'

compile 'com.google.android.gms:play-services-ads:10.2.1'

关于android - java.lang.NoSuchMethodError : No static method getDrawable(Landroid/content/Context;I) 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44497458/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com