android - Execution failed for task ':app:checkReleaseDuplicateClasses'.
访问量: 1
refer to: poe,
老项目编译时遇到了这个问题:
2: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:checkReleaseDuplicateClasses'. > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable > Duplicate class android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat found in modules support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0) and support-v4-23.4.0-runtime (com.android.support:support-v4:23.4.0) Duplicate class android.support.v4.app.ActionBarDrawerToggle found in modules support-core-ui-28.0.0-runtime (com.android.support:support-core-ui:28.0.0) and support-v4-23.4.0-runtime (com.android.support:support-v4:23.4.0) Duplicate class android.support.v4.app.ActionBarDrawerToggle$Delegate found in modules support-core-ui-28.0.0-runtime (com.android.support:support-core-ui:28.0.0) and support-v4-23.4.0-runtime (com.android.support:support-v4:23.4.0) Duplicate class android.support.v4.app.ActionBarDrawerToggle$DelegateProvider found in modules support-core-ui-28.0.0-runtime (com.android.support:support-core-ui:28.0.0) and support-v4-23.4.0-runtime (com.android.support:support-v4:23.4.0) Duplicate class android.support.v4.app.ActionBarDrawerToggle$SlideDrawable found in modules support-core-ui-28.0.0-runtime (com.android.support:support-core-ui:28.0.0) and support-v4-23.4.0-runtime (com.android.support:support-v4:23.4.0)
解决办法:
修改gradle.properties: 增加下面2行:
android.enableJetifier=true
android.useAndroidX=true // 只有这一行是不够的。