0
我發現這個代碼的Android:安裝apk時,是否可以將一個apk中的所有dex變成燕麥?
bool DexFile::OpenFromZip(const ZipArchive& zip_archive, const std::string& location,
std::string* error_msg, std::vector<const DexFile*>* dex_files) {
ZipOpenErrorCode error_code;
std::unique_ptr<const DexFile> dex_file(Open(zip_archive, kClassesDex, location, error_msg,
&error_code));
if (dex_file.get() == nullptr) {
return false;
} else {
// Had at least classes.dex.
dex_files->push_back(dex_file.release());
// Now try some more.
size_t i = 2;
while (i < 100) {
// We could try to avoid std::string allocations by working on a char array directly. As we
// do not expect a lot of iterations, this seems too involved and brittle.
std::string name = StringPrintf("classes%zu.dex", i);
std::string fake_location = location + ":" + name;
std::unique_ptr<const DexFile> next_dex_file(Open(zip_archive, name.c_str(), fake_location,
error_msg, &error_code));
if (next_dex_file.get() == nullptr) {
if (error_code != ZipOpenErrorCode::kEntryNotFound) {
LOG(WARNING) << error_msg;
}
break;
} else {
dex_files->push_back(next_dex_file.release());
}
i++;
}
return true;
從https://android.googlesource.com/platform/art/+/master/runtime/dex_file.cc主
是不是意味着,如果APK在根目錄多DEX,dex2oat會使用ART的時候把所有的DEX到OAT?
如何在安裝apk時將所有的dex轉換爲燕麥?