我看到Android的ant腳本有消息說它是「pre-dexing」。不過,dex和pre-dex使用相同的選項,但一次只能放入一個jar,而另一種情況下一次只能放置多個jar。什麼是Android Pre-Dexing以及如何提高性能?
真正的需求是什麼? pre-dex是強制性的嗎?
e.g
The ' characters around the executable and arguments are
not part of the command.
[dex] Pre-Dexing F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\libs\pinit-sdk-1.0.jar -> pinit-sdk-1.0-e3bebafa2727504605edf3d8d85b5d46.jar
[dx] Current OS is Windows 7
[dx] Executing 'D:\Apps\java\embd\cmn\android\oems\google\adt\4.x\4.3.x\4.3\sdk\build-tools\18.1.0\dx.bat' with arguments:
[dx] '--dex'
[dx] '--output'
[dx] 'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\dexedLibs\pinit-sdk-1.0-e3bebafa2727504605edf3d8d85b5d46.jar'
[dx] 'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\libs\pinit-sdk-1.0.jar'
[dx]
[dx] The ' characters around the executable and arguments are
[dx] not part of the command.
Execute:Java13CommandLauncher: Executing 'D:\Apps\java\embd\cmn\android\oems\google\adt\4.x\4.3.x\4.3\sdk\build-tools\18.1.0\dx.bat' with arguments:
'--dex'
'--output'
'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\dexedLibs\pinit-sdk-1.0-e3bebafa2727504605edf3d8d85b5d46.jar'
'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\libs\pinit-sdk-1.0.jar'
The ' characters around the executable and arguments are
not part of the command.
[dex] Converting compiled files and external libraries into F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\classes.dex...
[dx] Current OS is Windows 7
[dx] Executing 'D:\Apps\java\embd\cmn\android\oems\google\adt\4.x\4.3.x\4.3\sdk\build-tools\18.1.0\dx.bat' with arguments:
[dx] '--dex'
[dx] '--output'
[dx] 'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\classes.dex'
[dx] 'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\classes'
[dx] 'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\dexedLibs\classes-144740ee5cf8b90b747300d19fb8201e.jar'
[dx] 'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\dexedLibs\classes-1593da1bb60c5ec741aca494963e04a3.jar'
[dx] 'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\dexedLibs\classes-37bb5269e4fbd6dda9900fea95c0c29b.jar'
這個預定義過程是爲您可能包含在項目中的外部庫完成的。第二個dexing過程適用於您的應用程序(.class to .dex [DEX更適用於受限於內存和速度的系統])。每次構建應用程序時都需要Pre-Dexing,因爲:1)應用程序中的某些代碼(從外部庫中獲取)可能無法正常運行。 2)庫(您可能已從外部網站下載)可能已使用舊的java編譯器編譯(SDK Tools會爲此發出警告)。 – 10101010