运行时错误Android Studio - 因为添加JAR

时间:2016-05-02 15:04:14

标签: java android android-studio jar

首先我要道歉,如果我的帖子不准确,或者对其他帖子有一些苛刻的想象力,我可以用它来解决问题 - 一直在寻找,但没有找到。

所以,我正在使用Android Studio 2.1最新和最新版本。

所以我有一个应用程序做一些非常基本的东西.. 我使用声音等等,所以我尝试使用以下罐子:

First Jar | Second Jar

事情是,在尝试使用Jars之前,我可以完美地运行我的文件,App可以按预期工作。

当尝试通过添加2个Jars(或仅1个)以及使用这些Jars的相关类代码来扩展App功能时,应用程序将无法启动,甚至无法在设备或模拟器上加载。重要的是 - 我已经尝试仅使用罐子(没有新代码)运行应用程序以隔离问题并确保罐子是问题。

据我所知,这些Jars会导致问题,而这是SDK返回的错误日志:

Error:trouble processing "java/applet/Applet.class":
Error:Ill-advised or mistaken usage of a core class (java.* or javax.*)
Error:when not building a core library.
Error:This is often due to inadvertently including a core library file
Error:in your application's project, when using an IDE (such as
Error:Eclipse). If you are sure you're not intentionally defining a
Error:core class, then this is the most likely explanation of what's
Error:going on.
Error:However, you might actually be trying to define a class in a core
Error:namespace, the source of which you may have taken, for example,
Error:from a non-Android virtual machine project. This will most
Error:assuredly not work. At a minimum, it jeopardizes the
Error:compatibility of your app with future versions of the platform.
Error:It is also often of questionable legality.
Error:If you really intend to build a core library -- which is only
Error:appropriate as part of creating a full virtual machine
Error:distribution, as opposed to compiling an application -- then use
Error:the "--core-library" option to suppress this error message.
Error:If you go ahead and use "--core-library" but are in fact
Error:building an application, then be forewarned that your application
Error:will still fail to build or run, at some point. Please be
Error:prepared for angry customers who find, for example, that your
Error:application ceases to function once they upgrade their operating
Error:system. You will be to blame for this problem.
Error:If you are legitimately using some code that happens to be in a
Error:core package, then the easiest safe alternative you have is to
Error:repackage that code. That is, move the classes in question into
Error:your own package namespace. This means that they will never be in
Error:conflict with core system classes. JarJar is a tool that may help
Error:you in this endeavor. If you find that you cannot do this, then
Error:that is an indication that the path you are on will ultimately
Error:lead to pain, suffering, grief, and lamentation.
Error:1 error; aborting
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 1

抛出该错误后,进程终止,app甚至无法加载/开始运行。如果我删除jar文件并完全重新运行相同的代码 - 它可以正常工作。

1 个答案:

答案 0 :(得分:0)

看起来问题出在Jars文件中。包含旧库或IDE配置错误可能导致问题。根据android jar检查你的依赖项。 可能不得不考虑文件来解决问题......