

Now, of course, just because a Java package starts with java.* or javax.* does not necessarily mean that it depends on the JDK proper. The thinking is that classes in that namespace are likely to depend on other JDK "core" classes, which will break your app since they (may) not be present on Android. The -core-library option on Dx will bypass the stupidity check that prevents you from accidentally including Java core libraries in your Android app.ĭx will barf if you try to include a library that contains packages in the java.* or javax.* namespace. Lead to pain, suffering, grief, and lamentation. That is an indication that the path you are on will ultimately If you find that you cannot do this, then This means that they will never be inĬonflict with core system classes. That is, move the classes in question into If you are legitimately using some code that happens to be in aĬore package, then the easiest safe alternative you have is to

Prepared for angry customers who find, for example, that yourĪpplication ceases to function once they upgrade their operating Will still fail to build or run, at some point. If you go ahead and use "-core-library" but are in factīuilding an application, then be forewarned that your application The "-core-library" option to suppress this error message. If you really intend to build a core library - which is onlyĪppropriate as part of creating a full virtual machineĭistribution, as opposed to compiling an application - then use It is also often of questionable legality. At a minimum, it jeopardizes theĬompatibility of your app with future versions of the platform. Namespace, the source of which you may have taken, for example,įrom a non-Android virtual machine project. However, you might actually be trying to define a class in a core If you are sure you're not intentionally defining aĬore class, then this is the most likely explanation of what's In your application's project, when using an IDE (such asĮclipse). This is often due to inadvertently including a core library file Ill-advised or mistaken usage of a core class (java.* or javax.*)

Here's a relevant blurb from the dx source ( dalvik/dx/src/com/android/dx/command/dexer/Main.java), that gets printed if you try to include a java.* or javax.* class in an application. So this option is used for core.jar, where all those classes are actually defined. Normally, dx will refuse to process any java.* or javax.* classes. This is a special purpose flag that is only used when building some of the framework JAR files ( core.jar, framework.jar, etc.). apk file contains all necessary data to run the Android application and can be deployed to an Android device via the ADB (Android device bridge) tool. The program AAPT ( Android Asset Packaging Tool) performs APK creation. To understand better, look at the Android build process: dex file and the resources of an Android project, e.g., the images and XML files, are packed into an. dex files are therefore much smaller in size than the corresponding class files. dex file contains only one reference of this String. dex file.įor example, if the same String is found in different class files, the. During this conversion process redundant information in the class files are optimized in the. All class files of the application are placed in this. The dx tool converts Java class files into a *.dex (Dalvik executable)* file. The Java source files are converted to Java class files by the Java compiler. The dx.jar file was original located under android-sdk/platforms/android-X/tools/lib/ before (especially in Android 3 and Android 4) and was moved to android-sdk/platform-tools/lib/ later.

The dx tool converts Java class files into a *.dex ( Dalvik executable)* file.
