22.2.0版本的支持库cause compilation errors,可以通过强制使用旧版本的support-v4库来解决。
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:mediarouter-v7:22.2.0'
// Force stable version of support-v4
compile ('com.android.support:support-v4:22.1.1') {
force = true
}
这项工作解决了我的Android手机上的问题但是当我在模拟器上运行APK时,我收到以下错误。有谁知道如何让这个配置在模拟器上工作?
Could not find method android.support.v4.view.ViewCompat.isAttachedToWindow, referenced from method android.support.v7.app.AppCompatDelegateImplV7.createView
/AndroidRuntime(29569): java.lang.NoSuchMethodError: android.support.v4.view.ViewCompat.isAttachedToWindow
E/AndroidRuntime(29569): at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:792)
E/AndroidRuntime(29569): at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:832)
E/AndroidRuntime(29569): at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
E/AndroidRuntime(29569): at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$WrapperFactory2.onCreateView(CalligraphyLayoutInflater.java:280)
E/AndroidRuntime(29569): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
E/AndroidRuntime(29569): at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)
E/AndroidRuntime(29569): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
E/AndroidRuntime(29569): at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
E/AndroidRuntime(29569): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
E/AndroidRuntime(29569): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
E/AndroidRuntime(29569): at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
E/AndroidRuntime(29569): at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
E/AndroidRuntime(29569): at com.hightail.android.spaces.activities.NavigationDrawerActivity_.setContentView(NavigationDrawerActivity_.java:72)
E/AndroidRuntime(29569): at com.hightail.android.spaces.activities.NavigationDrawerActivity_.onCreate(NavigationDrawerActivity_.java:55)
E/AndroidRuntime(29569): at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime(29569): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime(29569): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
E/AndroidRuntime(29569): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
E/AndroidRuntime(29569): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime(29569): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime(29569): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(29569): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(29569): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime(29569): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(29569): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(29569): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime(29569): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime(29569): at dalvik.system.NativeStart.main(Native Method)