更新到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

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

问题描述

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

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'.

深入研究之后,我意识到问题出在 javax.mail 库.因此,在删除该库的每个.jar和每个引用之后,我可以再次构建,但是我删除了我的应用程序的此功能.

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.

我在Google上搜索了很多,并在 https://javaee.github.io/javamail/Android新信息(至少对我来说):我们不应再添加 additionnal.jar mail.jar activation.jar .我们必须添加新的依赖项:

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'

但是,在将这些行添加到我的 app.gradle 中之后,没有编写任何代码,我又遇到了上述错误.

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?

推荐答案

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

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.

我的解决方案是使用稍旧的版本1.6.0,而不是使用1.6.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'

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


一些详细信息

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

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.

相反,com.sun.mail:android-activation:1.6.0中不存在依赖项.

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

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

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

  • 使用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 (*) +---

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 (*) +---

  • 使用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

    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.

    使用1.6.1版的Android Studio屏幕截图

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

    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天全站免登陆