Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the Android SDK need a JDK?

I am trying to understand why the Android SDK needs the JDK.

  • The Android SDK is not supposed to have all the JDK Java classes it needs (with potential implementation differences) ?
  • Does it need it for all the tools included in the JDK ?
  • Do we use the JDK when we build .dex & .apk files ?
  • What does it mean to say that Android Java classes must be written with Java 5 or 6 compiler compliance ?

Thanks

like image 762
JeromePApp Avatar asked Aug 28 '13 13:08

JeromePApp


2 Answers

ANdoBuild

The general process for a typical build is outlined below:

  • The Android Asset Packaging Tool (aapt) takes your application resource files, such as the AndroidManifest.xml file and the XML
    files for your Activities, and compiles them. An R.java is also
    produced so you can reference your resources from your Java code.
  • The aidl tool converts any .aidl interfaces that you have into Java interfaces.
  • All of your Java code, including the R.java and .aidl files, are compiled by the Java compiler and .class files are output.
  • The dex tool converts the .class files to Dalvik byte code. Any 3rd party libraries and .class files that you have included in your
    project are also converted into .dex files so that they can be
    packaged into the final .apk file.
  • All non-compiled resources (such as images), compiled resources, and the .dex files are sent to the apkbuilder tool to be packaged into an .apk file.
  • Once the .apk is built, it must be signed with either a debug or release key before it can be installed to a device.
  • Finally, if the application is being signed in release mode, you must align the .apk with the zipalign tool. Aligning the final .apk decreases memory usage when the application is running on a device.

From here

like image 78
CRUSADER Avatar answered Nov 07 '22 17:11

CRUSADER


The Android SDK uses the JDK to compile your .java files to .class bytecode.

like image 40
SLaks Avatar answered Nov 07 '22 18:11

SLaks