Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

引入androidx.activity:activity-ktx:1.3.1后编译报错 #1051

Open
Yccc-argb opened this issue Dec 9, 2022 · 6 comments
Open

引入androidx.activity:activity-ktx:1.3.1后编译报错 #1051

Yccc-argb opened this issue Dec 9, 2022 · 6 comments

Comments

@Yccc-argb
Copy link

项目配置信息:
androidx

implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.qihoo360.replugin:replugin-plugin-lib-androidx:2.3.4'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'

build:tools:3.5.3
如果不进行插件化, 直接编译没问题
配置插件化之后
编译之后会报如下错误:

Task :app:mergeExtDexDebug FAILED
AGPBI: {"kind":"error","text":"Program type already present: kotlin.coroutines.jvm.internal.DebugProbesKt","sources":[{}],"tool":"D8"}
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: kotlin.coroutines.jvm.internal.DebugProbesKt
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:39)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:55)
at org.gradle.workers.internal.DefaultWorkerExecutor$1.call(DefaultWorkerExecutor.java:105)
at org.gradle.workers.internal.DefaultWorkerExecutor$1.call(DefaultWorkerExecutor.java:99)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
at com.android.tools.r8.utils.t.a(:55)
at com.android.tools.r8.D8.run(:11)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
... 30 more
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: kotlin.coroutines.jvm.internal.DebugProbesKt
at com.android.tools.r8.utils.Reporter.a(:21)
at com.android.tools.r8.utils.Reporter.a(:7)
at com.android.tools.r8.utils.t.a(:36)
... 32 more

Program type already present: kotlin.coroutines.jvm.internal.DebugProbesKt

Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete

Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: kotlin.coroutines.jvm.internal.DebugProbesKt

Execution failed for task ':app:mergeExtDexDebug'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: kotlin.coroutines.jvm.internal.DebugProbesKt

@mabaixiao
Copy link

@Yccc-argb 请问解决了吗

@Yccc-argb
Copy link
Author

@Yccc-argb 请问解决了吗
没有!!!
如果你不需要用到高版本的协程库的话, 可以按照这个方案解决
https://blog.csdn.net/zhijiandedaima/article/details/127110840

@Yccc-argb
Copy link
Author

@Yccc-argb 请问解决了吗
没有!!!
如果你不需要用到高版本的协程库的话, 可以按照这个方案解决
https://blog.csdn.net/zhijiandedaima/article/details/127110840

或者你有别的更好的处理方式吗?

@mabaixiao
Copy link

@Yccc-argb 请问解决了吗
没有!!!
如果你不需要用到高版本的协程库的话, 可以按照这个方案解决
https://blog.csdn.net/zhijiandedaima/article/details/127110840

或者你有别的更好的处理方式吗?

我好像也是这种方式

@wubibig
Copy link

wubibig commented Nov 7, 2023

可以修改插件代码,不处理kotlin库。修改位置:replugin-plugin-gradle/com/qihoo360/replugin/gradle/plugin/inner/Util.groovy
image

@koukoucai
Copy link

可以修改插件代码,不处理kotlin库。修改位置:replugin-plugin-gradle/com/qihoo360/replugin/gradle/plugin/inner/Util.groovy image

不处理kotlin会有什么后果吗?自己的那些kotlin代码就无法在插件中使用还是什么其他后果?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants