Error trying to create a signed APK android studio 3

I get the following error when trying to generate a signed APK in Android 3 studio

Error:trouble processing "javax/xml/namespace/QName.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 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 Error:Execution failed for task ':_4SaleApp:transformClassesWithDexForRelease'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --multi-dex --main-dex-list /Volumes/Data/AMIRA/Work/Q84Sale/Q84Sale/_4SaleApp/build/intermediates/multi-dex/release/maindexlist.txt --output /Volumes/Data/AMIRA/Work/Q84Sale/Q84Sale/_4SaleApp/build/intermediates/transforms/dex/release/0 --min-sdk-version 16 /Volumes/Data/AMIRA/Work/Q84Sale/Q84Sale/_4SaleApp/build/intermediates/transforms/jarMerging/release/0.jar} 

can anyone help?

+6
source share
3 answers

XPP's answer did not help me. Most cross-referenced responses ignore that this may be caused by other library dependencies (e.g. JARs / AARs). In my case, this error appeared only during the signed assembly - unsigned assemblies were in order.

Running "gradlew: [MY-PROJECT]: dependencies" shows a complete dependency tree. If you find a dependency that uses JARs or classes in the javax / java namespace, you can add an exclude gradle statement to your dependency declaration, for example (gradle 4.1 +):

api('my.favorite.dependency') { exclude group: 'javax' }

Then run the gradle: dependencies task. You should see that the excluded dependency is now removed from the tree. If this dependency is required for compilation and is not provided elsewhere, then the build * / build * tasks will not be completed. If the dependency is required at runtime and not provided elsewhere, for example. OS, then application. will compile and then crash on execution with the exception of "ClassNotFound".

In the worst case scenario, if the dependency tree doesn’t help much, then you may have to start the comment hangs and the code that uses them to find the dependency on the culprit. I hope that the dependency that caused this error was practically not used. When you find the dependency causing the error, you need to fix the situation in one of two ways. Or replace the JAR / AAR with one that does not cause an error; or rebuild the dependency so javax / java classes are not exported with JAR / AAR.

+1
source

I saw the same error. In my case, this was due to the fact that I turned on logback. Adding the following solution to the problem for me (as described here ):

 compile('com.github.tony19:logback-android-classic:1.1.1-6') { exclude group: 'com.google.android', module: 'android' } 

After adding the above, I still saw the problem (as described here ), and I had to add the following:

 configurations { all { exclude module: 'httpclient' } } 
0
source

I have the same problem. I followed @Amira Elsayed Ismail's recommendation and was demoted to 2.3.3

The building error disappeared, but I got a new wired warning. Warning:Ignoring Android API artifact com.google.android:android:4.1.1.4 for release . After a long search, I knew that this error occurs because one of my dependencies in the project depends on com.google.android:android, which means that this dependency directly declared a dependency on the Android version.

I need to know which of my dependencies is causing this warning. I tried to comment on the dependencies one by one in the \ build.gradle application and build the project.

In my case, when I deleted this package, compile 'com.sematext.android:sematext-logsene:1.0.0' project built without any errors.

Now we have found a package that depends on the version of android inside, we must eliminate this internal dependency for the version of Android.

I changed compile 'com.sematext.android:sematext-logsene:1.0.0' to

 compile ('com.sematext.android:sematext-logsene:1.0.0'){ exclude group: 'com.google.android' } 

Now everything is working fine; but I am still using the OLD version of gradle. I went back to app \ build.gradle and brought the gradient version back to 3.0.1

Now I fixed the problem and still used the last degree.

0
source

Source: https://habr.com/ru/post/1273003/


All Articles