今天,写好Demo兴致勃勃准备打个Jar包在Unity中测试下,不料,突然出现AGPBI这个异常,日志如下:
AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.app.BackStackRecord$Op","sources":[{}],"tool":"D8"} :app:transformClassesWithDexBuilderForDebug UP-TO-DATE AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.app.BackStackRecord$Op","sources":[{}],"tool":"D8"} :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\0.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\1.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\2.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\3.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\4.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\5.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\6.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\7.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\8.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\9.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\10.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\11.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\12.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\13.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\14.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\15.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\16.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\17.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\18.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\19.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\20.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\21.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\22.jar, E:\AiYouDemo\UcenterSdkTest\app\build\intermediates\transforms\dexBuilder\debug\23.jar * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 0s20 actionable tasks: 1 executed, 19 up-to-date10:36:12: Task execution finished 'exportJar'.
网上搜索,发现很多人都说包重复引用导致,但是LZ这是一个简单得Demo,并没有依赖太多项,况且,有的小伙伴说,需要分包,LZ瞬间很是不解,毛都没,分个啥?
随后,果断检查代码,查看是不是由于疏忽导致这种问题,果然:
打包时,LZ忘记将application:
apply plugin: ‘com.android.application’
修改为library:
apply plugin: ‘com.android.library’
实属尴尬啊~
吐槽下Bus编辑器,难用要死。。。噗
點擊查看更多內(nèi)容
為 TA 點贊
評論
評論
共同學(xué)習(xí),寫下你的評論
評論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦