更新到 Android Studio 3.1 后,项目未构建:程序类型已存在:com.sun.activation.registries.LineTokenizer [英] After update to Android Studio 3.1 the project does not build: Program type already present: com.sun.activation.registries.LineTokenizer

查看:33
本文介绍了更新到 Android Studio 3.1 后,项目未构建:程序类型已存在:com.sun.activation.registries.LineTokenizer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将我的 Android Studio 更新到了 3.1 版,但我对一条未知的错误消息感到惊讶:程序类型已经存在:com.sun.activation.registries.LineTokenizer

>:testeapn:transformClassesWithDexBuilderForDebug AGPBI:>{"kind":"error","text":"程序类型已经存在:com.sun.activation.registries.LineTokenizer","sources":[{}],"tool":"D8"}>:testeapn:transformDexArchiveWithExternalLibsDexMergerForDebug 失败>>FAILURE:构建失败,出现异常.>>* 出了什么问题:任务 ':testeapn:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败.

经过大量挖掘后,我意识到问题出在 javax.mail 库上.因此,在删除每个 .jar 和对该库的每个提及后,我可以再次构建,但我删除了我的应用程序的此功能.

现在我必须让我的应用程序再次发送邮件,但我找不到如何做到这一点,我请求您的帮助.

我谷歌了很多,发现在 https://javaee.github.io/javamail/Android 新信息(至少对我而言):我们不应再添加 additionnal.jarma​​il.jaractivation.jar.我们必须添加新的依赖项:

<块引用>

实现'com.sun.mail:android-mail:1.6.1'实现 'com.sun.mail:android-activation:1.6.1'

但是,在我的 app.gradle 中添加这些行并且没有编写一行代码后,我再次遇到上述错误.

有人知道这条消息是什么意思以及该怎么做吗?

解决方案

从 3 个 jars (additionnal.jar, mail.jaractivation.jar) 到 com.sun.mail:android-mail:1.6.1com.sun.mail:android-activation:1.6.1.我也在使用 Android Studio 3.1.

我的解决方案是,不使用 1.6.1,而是使用稍旧的 1.6.0 版本.错误消失,应用重新构建并运行.

<块引用>

<代码>实现 'com.sun.mail:android-mail:1.6.0'实现 'com.sun.mail:android-activation:1.6.0'

<小时>

一些细节

我在那里做了一些挖掘.似乎问题在于 com.sun.mail:android-activation:1.6.1 依赖于 javax.activation:activation:1.1,并且这两个包都包含com.sun.activation.registries.* 类.它导致构建失败.

相反,com.sun.mail:android-activation:1.6.0中没有依赖.

依赖图是通过运行gradlew :app:dependencies --configuration debugRuntimeClasspath生成的.

  • 使用 1.6.0 时<块引用>

    <代码>debugRuntimeClasspath - 变体运行时的已解析配置:调试+--- com.sun.mail:android-mail:1.6.1|+--- com.sun.mail:android-activation:1.6.1||\--- javax.activation:activation:1.1|\--- javax.activation:activation:1.1+--- com.sun.mail:android-activation:1.6.1 (*)+---

  • 使用 1.6.0 时<块引用>

    <代码>debugRuntimeClasspath - 变体运行时的已解析配置:调试+--- com.sun.mail:android-mail:1.6.0|\--- com.sun.mail:android-activation:1.6.0+--- com.sun.mail:android-activation:1.6.0

您也可以在以下屏幕截图中看到它.

使用 1.6.1 版时的 Android Studio 屏幕截图

虽然我想向他们的开发人员发布错误报告.他们的旧问题跟踪器页面(https://github.com/javaee/javamail/issues)已关闭,他们在 Eclipse Foundation 上的新项目页面 (https://projects.eclipse.org/项目/ee4j.javamail) 非常慢,我几乎无法打开它.

I just updated my Android Studio to version 3.1 and I was surprised with an unknown error message: Program type already present: com.sun.activation.registries.LineTokenizer

> :testeapn:transformClassesWithDexBuilderForDebug AGPBI:
> {"kind":"error","text":"Program type already present: com.sun.activation.registries.LineTokenizer","sources":[{}],"tool":"D8"}
> :testeapn:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
> 
> FAILURE: Build failed with an exception.
> 
> * What went wrong: Execution failed for task ':testeapn:transformDexArchiveWithExternalLibsDexMergerForDebug'.

After digging a lot I realized the problems was the javax.mail library. So, after remove every .jar and every mentions to that library and I could build again, but I removed this feature of my app.

Now I have to make my app to send mails again, but I can't find how to do this and I'm asking you for a help.

I google a lot and found in https://javaee.github.io/javamail/Android new information (for me, at least): we should not add the additionnal.jar, mail.jar and activation.jar anymore. We must add new dependencies:

implementation 'com.sun.mail:android-mail:1.6.1'
implementation 'com.sun.mail:android-activation:1.6.1'

But, after add those lines in my app.gradle and without write a line of code, I got the above error again.

Do someone know what this message means and what to do?

解决方案

I had exactly the same problem as you after upgrading from the 3 jars (additionnal.jar, mail.jar and activation.jar) to com.sun.mail:android-mail:1.6.1 and com.sun.mail:android-activation:1.6.1. I am also using Android Studio 3.1.

My solution is, instead of using 1.6.1, using the a little bit older version 1.6.0. The error is gone and the app builds and works again.

implementation 'com.sun.mail:android-mail:1.6.0' implementation 'com.sun.mail:android-activation:1.6.0'


Some details

I did a little digging there. It seems the problem is that com.sun.mail:android-activation:1.6.1 has a dependency on javax.activation:activation:1.1, and both these packages contain com.sun.activation.registries.* classes. It caused the build to fail.

On the contrary, the dependency wasn't there in com.sun.mail:android-activation:1.6.0.

The dependency graph is generated by running gradlew :app:dependencies --configuration debugRuntimeClasspath.

  • when using 1.6.0

    debugRuntimeClasspath - Resolved configuration for runtime for variant: debug +--- com.sun.mail:android-mail:1.6.1 | +--- com.sun.mail:android-activation:1.6.1 | | \--- javax.activation:activation:1.1 | \--- javax.activation:activation:1.1 +--- com.sun.mail:android-activation:1.6.1 (*) +---

  • when using 1.6.0

    debugRuntimeClasspath - Resolved configuration for runtime for variant: debug +--- com.sun.mail:android-mail:1.6.0 | \--- com.sun.mail:android-activation:1.6.0 +--- com.sun.mail:android-activation:1.6.0

You can see it in the following screen shot too.

Android Studio screen shot when using version 1.6.1

Though I would like to issue a bug report to their developers. Their old Issue Tracker page (https://github.com/javaee/javamail/issues) is closed, and their new project page on Eclipse Foundation (https://projects.eclipse.org/projects/ee4j.javamail) is extremely slow that I can barely open it.

这篇关于更新到 Android Studio 3.1 后,项目未构建:程序类型已存在:com.sun.activation.registries.LineTokenizer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆