【问题标题】:FAILURE: Build failed with an exception. Android JavaFAILURE:构建失败并出现异常。安卓Java
【发布时间】:2022-02-16 22:10:58
【问题描述】:

当我尝试运行应用程序时,遇到如下长错误。我该如何解决这个问题?

你能帮帮我吗?

FAILURE:构建失败并出现异常。

执行任务:项目/Users/Developer/projectname中的[:app:assembleDebug]

FAILURE:构建失败并出现异常。

  • 出了什么问题: 任务“:app:checkDebugDuplicateClasses”执行失败。

执行 com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable 时发生故障 在模块 collection-1.1.0 (androidx.collection:collection:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现了重复的类 androidx.collection.LruCache 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.accessibilityservice.AccessibilityServiceInfoCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.app.ActivityCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.app.NavUtils ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.app.NotificationCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.core.app.NotificationCompat$Builder :r7) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.app.ServiceCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.app.ShareCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.core.app.ShareCompat$IntentBuilder :r7) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.core.app.ShareCompat$IntentReader :r7) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.app.TaskStackBuilder ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.content.IntentCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.core.content.pm.ActivityInfoCompat :r7) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.database.DatabaseUtilsCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.os.ParcelableCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.os.ParcelableCompatCreatorCallbacks ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.util.DebugUtils ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现了重复的类 androidx.core.util.LogWriter ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.util.TimeUtils ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.view.AccessibilityDelegateCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.view.MenuCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.view.MenuItemCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.view.MotionEventCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.view.VelocityTrackerCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.view.ViewCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.view.ViewConfigurationCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.view.ViewGroupCompat ) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.core.view.accessibility.AccessibilityEventCompat :r7) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.core.view.accessibility.AccessibilityManagerCompat :r7) 重复类 androidx.core.view.accessibility.AccessibilityManagerCompat$AccessibilityStateChangeListenerCompat 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support -v4:r7) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.core.view.accessibility.AccessibilityNodeInfoCompat :r7) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.core.view.accessibility.AccessibilityRecordCompat :r7) 在模块 core-1.3.2-runtime (androidx.core:core:1.3.2) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.core.widget.EdgeEffectCompat ) 在模块 cursoradapter-1.0.0-runtime (androidx.cursoradapter:cursoradapter:1.0.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.cursoradapter.widget.CursorAdapter ) 在模块 cursoradapter-1.0.0-runtime (androidx.cursoradapter:cursoradapter:1.0.0) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.cursoradapter.widget.CursorAdapter$ChangeObserver :r7) 在模块 cursoradapter-1.0.0-runtime (androidx.cursoradapter:cursoradapter:1.0.0) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.cursoradapter.widget.CursorAdapter$MyDataSetObserver :r7) 在模块 cursoradapter-1.0.0-runtime (androidx.cursoradapter:cursoradapter:1.0.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.cursoradapter.widget.CursorFilter ) 在模块 cursoradapter-1.0.0-runtime (androidx.cursoradapter:cursoradapter:1.0.0) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.cursoradapter.widget.CursorFilter$CursorFilterClient :r7) 在模块 cursoradapter-1.0.0-runtime (androidx.cursoradapter:cursoradapter:1.0.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.cursoradapter.widget.ResourceCursorAdapter ) 在模块 cursoradapter-1.0.0-runtime (androidx.cursoradapter:cursoradapter:1.0.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现了重复的类 androidx.cursoradapter.widget.SimpleCursorAdapter ) 在模块 cursoradapter-1.0.0-runtime (androidx.cursoradapter:cursoradapter:1.0.0) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.cursoradapter.widget.SimpleCursorAdapter$CursorToStringConverter :r7) 在模块 cursoradapter-1.0.0-runtime (androidx.cursoradapter:cursoradapter:1.0.0) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.cursoradapter.widget.SimpleCursorAdapter$ViewBinder :r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.BackStackRecord ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.BackStackState ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.DialogFragment ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.Fragment ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.fragment.app.Fragment$InstantiationException :r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.fragment.app.Fragment$SavedState :r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support- v4:r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.FragmentActivity ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.FragmentManager ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.fragment.app.FragmentManager$BackStackEntry :r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4) 中发现重复的类 androidx.fragment.app.FragmentManager$OnBackStackChangedListener :r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.FragmentManagerImpl ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.FragmentManagerState ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.FragmentPagerAdapter ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.FragmentState ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.FragmentStatePagerAdapter ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.FragmentTransaction ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.ListFragment ) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4: r7) 在模块 fragment-1.1.0-runtime (androidx.fragment:fragment:1.1.0) 和 jetified-support-v4-r7 (com.google.android:support-v4:r7) 中发现重复的类 androidx.fragment.app.SuperNotCalledException ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0.0) 中发现重复的类 androidx.loader.app.LoaderManager ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0) 中发现重复的类 androidx.loader.app.LoaderManager$LoaderCallbacks .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0.0) 中发现重复的类 androidx.loader.app.LoaderManagerImpl ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0) 中发现重复的类 androidx.loader.app.LoaderManagerImpl$LoaderInfo .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0.0) 中发现重复的类 androidx.loader.content.AsyncTaskLoader ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0) 中发现重复的类 androidx.loader.content.AsyncTaskLoader$LoadTask .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0.0) 中发现重复的类 androidx.loader.content.CursorLoader ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0.0) 中发现重复的类 androidx.loader.content.Loader ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0) 中发现重复的类 androidx.loader.content.Loader$ForceLoadContentObserver .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0) 中发现重复的类 androidx.loader.content.Loader$OnLoadCompleteListener .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0.0) 中发现重复的类 androidx.loader.content.ModernAsyncTask ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0. 0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0. 0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0. 0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0. 0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0) 中发现重复的类 androidx.loader.content.ModernAsyncTask$AsyncTaskResult .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0) 中发现重复的类 androidx.loader.content.ModernAsyncTask$InternalHandler .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0) 中发现重复的类 androidx.loader.content.ModernAsyncTask$Status .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 loader-1.0.0-runtime (androidx.loader:loader:1.0) 中发现重复的类 androidx.loader.content.ModernAsyncTask$WorkerRunnable .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 localbroadcastmanager-1.0.0-runtime (androidx.localbroadcastmanager:localbroadcastmanager:1.0.0) 中发现重复的类 androidx.localbroadcastmanager.content.LocalBroadcastManager ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 localbroadcastmanager-1.0.0-runtime (androidx.localbroadcastmanager:localbroadcastmanager:1.0. 0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 localbroadcastmanager-1.0.0-runtime (androidx.localbroadcastmanager:localbroadcastmanager:1.0) 中发现重复的类 androidx.localbroadcastmanager.content.LocalBroadcastManager$BroadcastRecord .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 localbroadcastmanager-1.0.0-runtime (androidx.localbroadcastmanager:localbroadcastmanager:1.0) 中发现重复的类 androidx.localbroadcastmanager.content.LocalBroadcastManager$ReceiverRecord .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0.0) 中发现重复的类 androidx.viewpager.widget.PagerAdapter ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0.0) 中发现重复的类 androidx.viewpager.widget.PagerTitleStrip ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0) 中发现重复的类 androidx.viewpager.widget.PagerTitleStrip$PageListener .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0.0) 中发现重复的类 androidx.viewpager.widget.ViewPager ) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0. 0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0. 0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0) 中发现重复的类 androidx.viewpager.widget.ViewPager$ItemInfo .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0) 中发现重复的类 androidx.viewpager.widget.ViewPager$LayoutParams .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0) 中发现重复的类 androidx.viewpager.widget.ViewPager$OnAdapterChangeListener .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0) 中发现重复的类 androidx.viewpager.widget.ViewPager$OnPageChangeListener .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0) 中发现重复的类 androidx.viewpager.widget.ViewPager$PagerObserver .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0) 中发现重复的类 androidx.viewpager.widget.ViewPager$SavedState .0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager: 1.0.0) 在模块 jetified-support-v4-r7 (com.google.android:support-v4:r7) 和 viewpager-1.0.0-runtime (androidx.viewpager:viewpager:1.0) 中发现重复的类 androidx.viewpager.widget.ViewPager$SimpleOnPageChangeListener .0)

 Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

  • 通过https://help.gradle.org获得更多帮助

此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 7.0 不兼容。 使用“--warning-mode all”显示各个弃用警告。 见https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

在 9 秒内构建失败 27 个可操作的任务:1 个已执行,26 个是最新的

运行:

构建 gradle(应用程序):

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

def keystorePropertiesFile = rootProject.file("keystore.properties")
// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()
// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    signingConfigs {
        release {
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
        }
    }
    compileSdkVersion 30
    buildToolsVersion '30.0.3'
    defaultConfig {
        applicationId "com.ligradyo.android"
        minSdkVersion 17
        targetSdkVersion 30
        versionCode 10
        versionName "1.1.0"
        multiDexEnabled true
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        manifestPlaceholders = [onesignal_app_id               : "4193dbe8-83d0-4d1c-8625-1cb42c2a37ae",
                                onesignal_google_project_number: "658644867384"]

        archivesBaseName = "ligradyo-$versionName"
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
    buildTypes {
        release {
            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation "androidx.core:core-ktx:1.3.2"
    implementation 'com.google.android.material:material:1.3.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.google.code.gson:gson:2.8.6'

    // Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.6.4'
    implementation 'com.squareup.retrofit2:converter-gson:2.6.4'

    //Glide
    implementation 'com.github.bumptech.glide:glide:4.12.0'
    kapt 'com.github.bumptech.glide:compiler:4.12.0'


    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    implementation 'com.viewpagerindicator:library:2.4.1'

    // Add the Firebase Crashlytics SDK.
    implementation platform("com.google.firebase:firebase-bom:26.8.0")
    implementation "com.google.firebase:firebase-crashlytics"
    implementation "com.google.firebase:firebase-analytics"
    implementation "com.google.firebase:firebase-auth"
    implementation 'com.google.firebase:firebase-messaging'
    implementation 'com.google.firebase:firebase-core'

    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.gms:play-services-location:18.0.0'
    implementation 'com.google.android.gms:play-services-analytics:17.0.0'

    implementation 'com.onesignal:OneSignal:3.15.6'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}

构建 gradle(项目)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.4.32'
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.3'
        classpath 'com.google.gms:google-services:4.3.5'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.10'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        maven { url "https://jitpack.io" }
        mavenCentral()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

【问题讨论】:

  • 我们可以查看您的build.gradle 文件吗?
  • 我添加了你能看到吗? @Blundell
  • 嗯,我猜重复的类来自'androidx.appcompat:appcompat:1.2.0',然后可能在您的gradle.properties 中您有android.enableJetifier=true,然后您遇到了这个问题,即您拥有的依赖项正在使用旧的将支持库转换为 androidx 时,您将获得一个重复的类:stackoverflow.com/questions/52033810/…
  • 非常感谢,但该问题的答案对我不起作用。 @Blundell

标签: java android gradle


【解决方案1】:

我创建了一个新项目并移动了现有的活动和设计页面,检查了页面并将所需库的最新版本添加到项目中,并且能够解决问题。

【讨论】:

    猜你喜欢
    • 2021-08-23
    • 2018-07-28
    • 2018-10-22
    • 2020-08-22
    • 1970-01-01
    • 2018-10-29
    • 2020-06-13
    • 2021-09-24
    相关资源
    最近更新 更多