Home | History | Annotate | Download | only in platform
      1 page.title=  Java8
      2 page.keywords="android N", "Java 8", "Jack"
      3 @jd:body
      4 
      5 <div id="qv-wrapper">
      6   <div id="qv">
      7     <ol>
      8       <li>
      9         <a href="#supported-features"> API-    Java8</a>
     10       </li>
     11       <li>
     12         <a href="#configuration">  Java8    Jack</a>
     13       </li>
     14     </ol>
     15   </div>
     16 </div>
     17 
     18 <p> AndroidN     Java8,
     19        AndroidN.
     20        ,   AndroidN
     21 Preview,       ,    
     22 ,    .
     23 </p>
     24 
     25 <p>        Android
     26 Studio2.1 ( )  AndroidN Preview SDK,    
     27 Jack     Android  Gradle.     
     28 AndroidN Preview SDK, . <a href="{@docRoot}preview/setup-sdk.html">    AndroidN</a>.</p>
     29 
     30 
     31 
     32 <p class="note">
     33   <strong>.</strong>     Java8    
     34      AndroidN.    
     35       Java8,  
     36 Java7      ,  -
     37      JDK8      AndroidN.
     38 </p>
     39 
     40 <h2 id="supported-features">
     41    API-    Java8
     42 </h2>
     43 
     44 <p>
     45      Android      Java8.
     46     
     47 AndroidN Preview   .
     48 </p>
     49 
     50 <ul>
     51   <li>
     52     <a class="external-link" href="https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html">
     53      </a>
     54   </li>
     55 
     56   <li>
     57     <a class="external-link" href="https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html">
     58 -</a>
     59   </li>
     60 
     61   <li>
     62     <a class="external-link" href="https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html">
     63 </a>
     64   </li>
     65 </ul>
     66 
     67 
     68 <p>
     69    ,   API-     Java8.
     70 </p>
     71 
     72 <ul>
     73   <li>API-    :
     74   </li>
     75 
     76   <li style="list-style: none; display: inline">
     77     <ul>
     78       <li>{@code java.lang.FunctionalInterface};
     79       </li>
     80 
     81       <li>{@code java.lang.annotation.Repeatable};
     82       </li>
     83 
     84       <li>{@code java.lang.reflect.Method.isDefault()};
     85       </li>
     86 
     87       <li>  API- ,    , ,
     88 {@code AnnotatedElement.getAnnotationsByType(Class)}.
     89       </li>
     90     </ul>
     91   </li>
     92   <li> API:
     93   </li>
     94 
     95   <li style="list-style: none; display: inline">
     96     <ul>
     97       <li>{@code java.util.function}.
     98       </li>
     99     </ul>
    100   </li>
    101 </ul>
    102 
    103 <p class="note">
    104   <strong>.</strong>  AndroidN 
    105 -     .    
    106         Android.  
    107 -       {@code
    108   build.gradle}     {@code compileSdkVersion}  {@code
    109   targetSdkVersion}  23  .
    110 </p>
    111 
    112 <h2 id="configuration">
    113     Java8    Jack
    114 </h2>
    115 
    116 <p>
    117        Java8   
    118  <a class="external-link" href="https://source.android.com/source/jack.html">  Jack</a>.   
    119 Android    Java   Android  Dalvik Executable (dex).
    120  Jack     {@code .jack},    
    121      : , ,  
    122    DEX.
    123 </p>
    124 
    125 <p>     ,     DEX  Android.</p>
    126 <ul>
    127   <li>   javac:<br>
    128   <b>javac</b> ({@code .java} --&gt; {@code .class}) --&gt; <b>dx</b> ({@code
    129   .class} --&gt; {@code .dex})
    130   </li>
    131 
    132   <li>   Jack:<br>
    133   <b>Jack</b> ({@code .java} --&gt; {@code .jack} --&gt; {@code .dex})
    134   </li>
    135 </ul>
    136 
    137 <h3>
    138    Gradle
    139 </h3>
    140 
    141 <p>
    142       Java8    Jack  , 
    143    {@code build.gradle}  :
    144 </p>
    145 
    146 <pre>
    147 android {
    148   ...
    149   defaultConfig {
    150     ...
    151     jackOptions {
    152       enabled true
    153     }
    154   }
    155   compileOptions {
    156     sourceCompatibility JavaVersion.VERSION_1_8
    157     targetCompatibility JavaVersion.VERSION_1_8
    158   }
    159 }
    160 </pre>
    161 
    162 <h3>
    163    
    164 </h3>
    165 
    166 <p>
    167    Instant Run,   Android Studio2.0 (Beta),  
    168    Jack      .
    169 </p>
    170 
    171 <p>   Jack       
    172 , ,    ,   Jack  .  
    173   .</p>
    174 
    175 <ul>
    176   <li> Lint,  c  .
    177   </li>
    178 
    179   <li>  ,      (, JaCoCo
    180  Mockito)</li>
    181 </ul>
    182 
    183 <p>          Jack, <a href="http://tools.android.com/filing-bugs">  </a>.</p>