I know that Android Studio switch to D8 dexer by default. But I wonder what's the file path of d8.jar ? I can't found d8.jar in SDK like dx.jar.
A typical dx.jar located in Android/Sdk/build-tools/<VERSION>/lib/:
xb@dnxb:~/Android/Sdk/build-tools/27.0.3/lib$ ls
apksigner.jar dx.jar shrinkedAndroid.jar
xb@dnxb:~/Android/Sdk/build-tools/27.0.3/lib$
My first thought is dx.jar means d8.jar, but seems like not the case.
The old dx.jar source code:
xb@dnxb:~/Downloads/dalvik/dx/src/com/android$ ls
dex dx multidex
xb@dnxb:~/Downloads/dalvik/dx/src/com/android$ ls -1 dex
Annotation.java
CallSiteId.java
ClassData.java
ClassDef.java
Code.java
DexException.java
DexFormat.java
DexIndexOverflowException.java
Dex.java
EncodedValueCodec.java
EncodedValue.java
EncodedValueReader.java
FieldId.java
Leb128.java
MethodHandle.java
MethodId.java
Mutf8.java
ProtoId.java
SizeOf.java
TableOfContents.java
TypeList.java
util
xb@dnxb:~/Downloads/dalvik/dx/src/com/android$
Is exactly the same as the .classes of dx.jar in 27.0.3 or older(e.g. 25.0.0) SDK (I unzip it):
xb@dnxb:~/Android/Sdk/build-tools/27.0.3/lib/dx/com/android$ ls
dex dx multidex
xb@dnxb:~/Android/Sdk/build-tools/27.0.3/lib/dx/com/android$ ls -1 dex | grep -v '\$'
Annotation.class
CallSiteId.class
ClassData.class
ClassDef.class
Code.class
Dex.class
DexException.class
DexFormat.class
DexIndexOverflowException.class
EncodedValue.class
EncodedValueCodec.class
EncodedValueReader.class
FieldId.class
Leb128.class
MethodHandle.class
MethodId.class
Mutf8.class
ProtoId.class
SizeOf.class
TableOfContents.class
TypeList.class
util
xb@dnxb:~/Android/Sdk/build-tools/27.0.3/lib/dx/com/android$
But the new d8.jar has totally difference structure:
xb@dnxb:~/Downloads/r8/build/libs/d8/com/android/tools/r8$ ls
annotations ExtractMarkerCommand.class
ApiLevelException.class ExtractMarker$VdexOrigin.class
ArchiveClassFileProvider.class GenerateMainDexList.class
ArchiveProgramResourceProvider.class GenerateMainDexListCommand$1.class
ArchiveProgramResourceProvider$ZipFileSupplier.class GenerateMainDexListCommand$Builder.class
BaseCommand$Builder.class GenerateMainDexListCommand.class
BaseCommand.class graph
BaseCompilerCommand$Builder.class InternalProgramOutputPathConsumer.class
... omit
And I search filename with d8 keyword in both sdk and Android Studio, but no luck:
xb@dnxb:~$ find /home/xiaobai/Android/ -iname '*d8*'
xb@dnxb:~$ find ~/Downloads/AS/android-studio -iname '*d8*'
xb@dnxb:~$
So where's the file path of d8.jar in Android Studio ? My Android Studio version is 3.2 Canary 12 already, but how Android Studio invoke d8 by default if d8.jar not exist ? Or it hide in somewhere ?
D8 is part of the new R8 project. D8 does not share any history with dx - even though the naming might make it seem that way. dx is no longer actively being developed, but D8 is actively developed by Google as an open source project at https://r8-review.googlesource.com.
You should be able to find
r8.jar(notd8.jar- that doesn't exist) in your classpath, and if you want to use a different version of D8, you can put your ownr8.jaron your classpath.