Backbone of the new aapt2 strip command.
The strip command takes an APK as argument and a --target-densities flag which
contains the list of screen densities for which to optimize the APK. All
the resources that would be unused for a device having the given
densities are stripped from the APK leaving only the ones actually being
used.
Test: Manual.
Change-Id: I68368b00876a18ccdbbfc0a8dd265bd361117933
diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp
index 15d7e2e..3ed698b 100644
--- a/tools/aapt2/Main.cpp
+++ b/tools/aapt2/Main.cpp
@@ -37,6 +37,7 @@
extern int Link(const std::vector<android::StringPiece>& args);
extern int Dump(const std::vector<android::StringPiece>& args);
extern int Diff(const std::vector<android::StringPiece>& args);
+extern int Strip(const std::vector<android::StringPiece>& args);
} // namespace aapt
@@ -59,6 +60,8 @@
return aapt::Dump(args);
} else if (command == "diff") {
return aapt::Diff(args);
+ } else if (command == "strip") {
+ return aapt::Strip(args);
} else if (command == "version") {
return aapt::PrintVersion();
}
@@ -67,7 +70,7 @@
std::cerr << "no command specified\n";
}
- std::cerr << "\nusage: aapt2 [compile|link|dump|diff|version] ..."
+ std::cerr << "\nusage: aapt2 [compile|link|dump|diff|strip|version] ..."
<< std::endl;
return 1;
}