当我没有为v7支持库添加android proguard配置时,我的应用程序崩溃了:
java.lang.AbstractMethodError: abstract method "android.view.View android.view.LayoutInflater$Factory2.onCreateView(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet)"
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:4127)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:4203)
at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1991)
at android.support.v7.app.f.v(AppCompatDelegateImplV9.java:374)
at android.support.v7.app.f.u(AppCompatDelegateImplV9.java:323)
at android.support.v7.app.f.b(AppCompatDelegateImplV9.java:170)
at android.support.v7.app.AppCompatActivity.onPostCreate(AppCompatActivity.java:97)
at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1187)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2386)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477)
at android.app.ActivityThread.access$800(ActivityThread.java:160)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5372)
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:1117)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
我猜这可能是由于我还没有添加的proguard配置引起的。所以,我添加了以下配置:
-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
但是,这也导致建筑失败。我收到了这些消息:
Warning:Exception while processing task java.io.IOException: Can't write [/Users/looyoo/Documents/welian-android/app/build/intermediates/transforms/proguard/release/0.jar] (Can't read [/Users/looyoo/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.0.aar/decb3e4b44f48252475eee23a4f22565/jars/classes.jar(;;;;;;**.class)] (Duplicate zip entry [android/support/v7/widget/ListPopupWindow$1.class == classes.jar:android/support/v7/widget/ListPopupWindow$2.class]))
我也检查了图书馆' v7支持版本和v4支持版本,没有不同的版本。
这是我的依赖树:
+--- com.android.databinding:library:1.3.1
| +--- com.android.support:support-v4:21.0.3 -> 27.1.0
| | +--- com.android.support:support-compat:27.1.0
| | | +--- com.android.support:support-annotations:27.1.0
| | | \--- android.arch.lifecycle:runtime:1.1.0
| | | +--- android.arch.lifecycle:common:1.1.0
| | | | \--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| | | +--- android.arch.core:common:1.1.0
| | | | \--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| | | \--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| | +--- com.android.support:support-media-compat:27.1.0
| | | +--- com.android.support:support-annotations:27.1.0
| | | \--- com.android.support:support-compat:27.1.0 (*)
| | +--- com.android.support:support-core-utils:27.1.0
| | | +--- com.android.support:support-annotations:27.1.0
| | | \--- com.android.support:support-compat:27.1.0 (*)
| | +--- com.android.support:support-core-ui:27.1.0
| | | +--- com.android.support:support-annotations:27.1.0
| | | +--- com.android.support:support-compat:27.1.0 (*)
| | | \--- com.android.support:support-core-utils:27.1.0 (*)
| | \--- com.android.support:support-fragment:27.1.0
| | +--- com.android.support:support-compat:27.1.0 (*)
| | +--- com.android.support:support-core-ui:27.1.0 (*)
| | +--- com.android.support:support-core-utils:27.1.0 (*)
| | +--- com.android.support:support-annotations:27.1.0
| | +--- android.arch.lifecycle:livedata-core:1.1.0
| | | +--- android.arch.lifecycle:common:1.1.0 (*)
| | | +--- android.arch.core:common:1.1.0 (*)
| | | \--- android.arch.core:runtime:1.1.0
| | | +--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| | | \--- android.arch.core:common:1.1.0 (*)
| | \--- android.arch.lifecycle:viewmodel:1.1.0
| | \--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| \--- com.android.databinding:baseLibrary:2.3.0-dev -> 3.0.1
+--- com.android.databinding:baseLibrary:3.0.1
+--- com.android.databinding:adapters:1.3.1
| +--- com.android.databinding:library:1.3 -> 1.3.1 (*)
| \--- com.android.databinding:baseLibrary:2.3.0-dev -> 3.0.1
+--- project :IMKit
| +--- com.android.support:support-v4:27.1.0 (*)
| \--- project :IMLib
+--- project :thirdpart
| +--- com.aliyun.dpa:oss-android-sdk:2.2.0
| \--- project :common
| +--- com.android.support:design:27.1.0
| | +--- com.android.support:support-v4:27.1.0 (*)
| | +--- com.android.support:appcompat-v7:27.1.0
| | | +--- com.android.support:support-annotations:27.1.0
| | | +--- com.android.support:support-core-utils:27.1.0 (*)
| | | +--- com.android.support:support-fragment:27.1.0 (*)
| | | +--- com.android.support:support-vector-drawable:27.1.0
| | | | +--- com.android.support:support-annotations:27.1.0
| | | | \--- com.android.support:support-compat:27.1.0 (*)
| | | \--- com.android.support:animated-vector-drawable:27.1.0
| | | +--- com.android.support:support-vector-drawable:27.1.0 (*)
| | | \--- com.android.support:support-core-ui:27.1.0 (*)
| | +--- com.android.support:recyclerview-v7:27.1.0
| | | +--- com.android.support:support-annotations:27.1.0
| | | +--- com.android.support:support-compat:27.1.0 (*)
| | | \--- com.android.support:support-core-ui:27.1.0 (*)
| | \--- com.android.support:transition:27.1.0
| | +--- com.android.support:support-annotations:27.1.0
| | \--- com.android.support:support-compat:27.1.0 (*)
| +--- com.android.support:cardview-v7:27.1.0
| | \--- com.android.support:support-annotations:27.1.0
| +--- com.google.code.gson:gson:2.4 -> 2.7
| +--- com.android.support:multidex:1.0.1
| +--- com.j256.ormlite:ormlite-android:4.48
| | \--- com.j256.ormlite:ormlite-core:4.48
| +--- com.tencent.bugly:crashreport:latest.release -> 2.6.6.1
| +--- com.qiyukf.unicorn:unicorn:3.10.0
| +--- com.wanjian:sak:0.0.2
| +--- project :gridpassword
| | \--- com.android.support:appcompat-v7:27.1.0 (*)
| +--- com.taobao.android:alisdk-hotfix:2.0.6
| | \--- com.taobao.android:alicloud-report:1.0.1
| +--- io.reactivex.rxjava2:rxandroid:2.0.1
| | \--- io.reactivex.rxjava2:rxjava:2.0.1 -> 2.1.0
| | \--- org.reactivestreams:reactive-streams:1.0.0
| +--- io.reactivex.rxjava2:rxjava:2.1.0 (*)
| +--- com.jakewharton.rxbinding2:rxbinding:2.0.0
| | +--- io.reactivex.rxjava2:rxjava:2.0.2 -> 2.1.0 (*)
| | +--- io.reactivex.rxjava2:rxandroid:2.0.0 -> 2.0.1 (*)
| | \--- com.android.support:support-annotations:25.1.1 -> 27.1.0
| \--- org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.21
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.2.21
| \--- org.jetbrains:annotations:13.0
+--- project :qrcode
| \--- project :commonui
| +--- project :thirdpart (*)
| +--- project :swipbacklib
| | +--- com.android.support:appcompat-v7:27.1.0 (*)
| | \--- com.android.support:support-v4:27.1.0 (*)
| +--- com.gzsll.jsbridge:library:1.1.0
| \--- android.arch.lifecycle:extensions:1.1.0
| +--- android.arch.lifecycle:runtime:1.1.0 (*)
| +--- android.arch.core:common:1.1.0 (*)
| +--- android.arch.core:runtime:1.1.0 (*)
| +--- com.android.support:support-fragment:26.1.0 -> 27.1.0 (*)
| +--- android.arch.lifecycle:common:1.1.0 (*)
| +--- android.arch.lifecycle:livedata:1.1.0
| | +--- android.arch.core:runtime:1.1.0 (*)
| | +--- android.arch.lifecycle:livedata-core:1.1.0 (*)
| | \--- android.arch.core:common:1.1.0 (*)
| \--- android.arch.lifecycle:viewmodel:1.1.0 (*)
+--- project :bdmap
| \--- project :commonui (*)
+--- project :MPChartLib
+--- project :magicindicator
| \--- project :common (*)
+--- com.zhy:percent-support-extends:1.1.1
+--- com.android.support.constraint:constraint-layout:1.0.2
| \--- com.android.support.constraint:constraint-layout-solver:1.0.2
+--- com.github.bumptech.glide:glide:3.8.0
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.21
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.2.21 (*)
+--- com.squareup.retrofit2:retrofit:2.3.0
| \--- com.squareup.okhttp3:okhttp:3.8.0
| \--- com.squareup.okio:okio:1.13.0
+--- com.squareup.okhttp3:logging-interceptor:3.8.0
| \--- com.squareup.okhttp3:okhttp:3.8.0 (*)
+--- com.squareup.retrofit2:converter-gson:2.1.0
| +--- com.squareup.retrofit2:retrofit:2.1.0 -> 2.3.0 (*)
| \--- com.google.code.gson:gson:2.7
+--- com.squareup.retrofit2:adapter-rxjava2:2.3.0
| +--- com.squareup.retrofit2:retrofit:2.3.0 (*)
| \--- io.reactivex.rxjava2:rxjava:2.0.0 -> 2.1.0 (*)
+--- com.makeramen:roundedimageview:2.3.0
+--- android.arch.lifecycle:extensions:1.1.0 (*)
+--- android.arch.persistence.room:runtime:1.0.0
| +--- android.arch.persistence.room:common:1.0.0
| | \--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| +--- android.arch.persistence:db-framework:1.0.0
| | +--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| | \--- android.arch.persistence:db:1.0.0
| | \--- com.android.support:support-annotations:26.1.0 -> 27.1.0
| +--- android.arch.persistence:db:1.0.0 (*)
| +--- android.arch.core:runtime:1.0.0 -> 1.1.0 (*)
| \--- com.android.support:support-core-utils:26.1.0 -> 27.1.0 (*)
+--- android.arch.persistence.room:rxjava2:1.0.0
| +--- android.arch.persistence.room:common:1.0.0 (*)
| +--- android.arch.persistence.room:runtime:1.0.0 (*)
| +--- android.arch.core:runtime:1.0.0 -> 1.1.0 (*)
| +--- com.android.support:support-core-utils:26.1.0 -> 27.1.0 (*)
| \--- io.reactivex.rxjava2:rxjava:2.0.6 -> 2.1.0 (*)
\--- com.antfortune.freeline:runtime-no-op:0.8.7