Android 带有 Zendesk SDK 的应用程序因 java 没有此类字段错误而崩溃

Android app with Zendesk SDK crashing with java no such field error

我正在使用 ZENDESK Android SDK 并尝试像这样打开支持 activity :

new com.zendesk.sdk.support.SupportActivity.Builder().listCategories().show(this);

但它因以下错误而崩溃:

java.lang.NoSuchFieldError: No static field support_search_input of type I in class Lcom/zendesk/sdk/R$id; or its superclasses (declaration of 'com.zendesk.sdk.R$id' appears in /data/data/nl.tirato.RoomEasy/files/instant-run/dex/slice-slice_2-classes.dex)
at com.zendesk.sdk.support.SupportActivity.onCreate(SupportActivity.java:205)
at android.app.Activity.performCreate(Activity.java:6289)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.access0(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

我正在使用最新的 sdk :

compile group: 'com.zendesk', name: 'sdk', version: '1.6.1.1'
compile group: 'com.zendesk', name: 'sdk-providers', version:'1.6.1.1'

我的 activity 正在扩展 AppCompatActivity

感谢任何帮助。

谢谢

您的资源文件中是否也有 support_search_input 的定义?这可能是命名冲突。

您好,只需将依赖项替换为版本 compile group: 'com.zendesk', name: 'sdk', version: '1.10.0.1'