android-studio - android studio 添加一个外部Jar之后,编译不通过
PHP中文网
PHP中文网 2017-04-17 17:42:31
0
2
414

因为功能的需要,添加了一个外部的jar包,添加之后运行就报出以下错误,

Error:trouble processing "java/lang/AutoCloseable.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 '/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
PHP中文网
PHP中文网

认证0级讲师

membalas semua(2)
左手右手慢动作

Saya sendiri telah menemui penyelesaian, tetapi tidak jelas mengapa saya melakukan ini. .
Penyelesaian: Ubah suai atribut skop pakej jar yang menyebabkan ralat, yang disediakan oleh compile->disediakan Operasi ini boleh diubah suai dalam File->Struktur Projek->Dependencies atau dalam binaan dalam. folder aplikasi di bawah paparan projek Terdapat kandungan kebergantungan dalam fail .gradle Ubah suai kompilasi pakej jar yang sepadan dengan disediakan

伊谢尔伦

Cuba susun dengan jdk1.7

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan