我在Activity类中使用了CollapsingToolbarLayout,当我构建时,我看到以下异常:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.totoroads.android.app, PID: 4596
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/com.totoroads.android.app/files/instant-run/dex/slice-internal_impl-24.2.0_aca63e91a3783d676855828331e4814bb550d297-classes.dex)
at android.support.v4.view.ViewCompat$LollipopViewCompatImpl.setOnApplyWindowInsetsListener(ViewCompat.java:1558)
at android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(ViewCompat.java:2829)
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:429)
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:316)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:281)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.totoroads.android.app.DetailListCarActivityDemo.onCreate(DetailListCarActivityDemo.java:33)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
我的依赖项:
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.totoroads.android.app"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
// compile 'org.apache.httpcomponents:httpmime:4.3.3'
//compile 'org.apache.httpcomponents:httpclient:4.5'
// compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.3'
compile 'com.googlecode.json-simple:json-simple:1.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:design:24.0.0-alpha1'
compile 'com.loopj.android:android-async-http:1.4.4'
// compile 'com.loopj.android:android-async-http:1.4.4'
//compile 'com.google.android.gms:play-services-maps:7.8.0'
// compile 'com.google.android.gms:play-services-location:7.8.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:recyclerview-v7:24.1.1'
// compile 'com.android.support:support-v4:24.0.0-alpha1'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.etsy.android.grid:library:1.0.5'
// check version: http://www.technotalkative.com/lazy-productive-android-developer-part-6-staggered-gridview/
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.android.support:cardview-v7:24.0.0'
// compile 'com.android.support:support-annotations:24.2.0'
}
图书馆似乎有问题,如何修复异常,非常感谢!!