在升级gradle插件时获取java.lang.NoSuchMethodError

时间:2016-08-22 12:42:49

标签: android gradle-plugin

我将我的android gradle插件升级为
classpath' com.android.tools.build:gradle:2.2.0-beta2'

我在HomeScreenActivity上遇到错误,如

MERGE INTO TableB As TB 
USING (Select Url From TableA) As TA 
ON TA.Url LIKE 'http://www.example.com/data/'+TB.Keyword+'-%' 
WHEN MATCHED THEN 
UPDATE SET TB.Value=1;

HomeScreenActivity代码是

Java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener(Landroid/view/View;Landroid/support/v4/view/OnApplyWindowInsetsListener;)V in class Landroid/support/v4/view/ViewCompatLollipop; or its super classes (declaration of 'android.support.v4.view.ViewCompatLollipop' appears in /data/data/test.bpl.com.bploximeterdemo/files/instant-run/dex/slice-internal_impl-24.2.0_adc91965034c97937e0e3e7bf26df26d4116a5ab-classes.dex)
                                                                                          at android.support.v4.view.ViewCompat$LollipopViewCompatImpl.setOnApplyWindowInsetsListener(ViewCompat.java:1537)
                                                                                          at android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(ViewCompat.java:2787)
                                                                                          at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:389)
                                                                                          at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:279)
                                                                                          at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:253)
                                                                                          at android.support.v7.app.AppCompatDialog.setContentView(AppCompatDialog.java:76)
                                                                                          at android.support.v7.app.AlertController.installContent(AlertController.java:213)
                                                                                          at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:240)
                                                                                          at android.app.Dialog.dispatchOnCreate(Dialog.java:394)
                                                                                          at android.app.Dialog.show(Dialog.java:295)
                                                                                          at wl.bpl.com.bploximeter.HomeScreenActivity.show_dialog(HomeScreenActivity.java:1252)
                                                                                          at wl.bpl.com.bploximeter.HomeScreenActivity.onCreate(HomeScreenActivity.java:235)
                                                                                          at android.app.Activity.performCreate(Activity.java:6259)
                                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
                                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
                                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
                                                                                          at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                          at android.os.Looper.loop(Looper.java:148)
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:5443)
                                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

请注意,这段代码很早就开始了

1 个答案:

答案 0 :(得分:1)

当我升级Android Studio时,我遇到了类似的问题。

更新每个支持库" com.android.support:xxx:..."在您的成绩档案中为24.2.0。

检查它是否对您有所帮助。

编辑:

粘贴我的gradle文件

依赖{     编译fileTree(包括:[' * .jar'],dir:' libs')     testCompile' junit:junit:4.12'     编译' com.android.support:appcompat-v7:24.2.0'     编译' com.android.support:cardview-v7:24.2.0'     编译' com.android.support:design:24.2.0'     编译com.google.android.gms:play-services:9.4.0'     编译' com.github.bumptech.glide:滑翔:3.7.0'     编译com.google.android.gms:play-services-auth:9.4.0'     编译项目(':组件') }

希望这就足够了。