能力值:
( LV2,RANK:10 )
2 楼
aapt只有windows版吗?
能力值:
( LV3,RANK:30 )
3 楼
顶一个~!
能力值:
( LV2,RANK:10 )
4 楼
目前只编译了windows版本,其它平台请自行编译,patch如下。
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index d8e113a..68cfcce 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -1976,6 +1976,8 @@ status_t AaptSymbols::applyJavaSymbols(const sp<AaptSymbols>& javaSymbols)
return err;
}
+bool AaptSymbols::mIgnoreKeywords = false;
+
// =========================================================================
// =========================================================================
// =========================================================================
diff --git a/tools/aapt/AaptAssets.h b/tools/aapt/AaptAssets.h
index 5cfa913..731acb7 100644
--- a/tools/aapt/AaptAssets.h
+++ b/tools/aapt/AaptAssets.h
@@ -377,9 +377,18 @@ public:
class AaptSymbols : public RefBase
{
public:
- AaptSymbols() { }
+ AaptSymbols() {
+ const char* p = getenv("AAPT_IGNORE_KEYWORDS");
+ if(p && p[0]){
+ setIgnoreKeywords(true);
+ }
+ }
virtual ~AaptSymbols() { }
+ static void setIgnoreKeywords(bool value) {
+ mIgnoreKeywords = value;
+ }
+
status_t addSymbol(const String8& name, int32_t value, const SourcePos& pos) {
if (!check_valid_symbol_name(name, pos, "symbol")) {
return BAD_VALUE;
@@ -473,7 +482,7 @@ public:
private:
bool check_valid_symbol_name(const String8& symbol, const SourcePos& pos, const char* label) {
- if (valid_symbol_name(symbol)) {
+ if (mIgnoreKeywords || valid_symbol_name(symbol)) {
return true;
}
pos.error("invalid %s: '%s'\n", label, symbol.string());
@@ -498,6 +507,7 @@ private:
return mDefSymbol;
}
+ static bool mIgnoreKeywords;
KeyedVector<String8, AaptSymbolEntry> mSymbols;
DefaultKeyedVector<String8, sp<AaptSymbols> > mNestedSymbols;
AaptSymbolEntry mDefSymbol;
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp
index 977226b..fae19b1 100644
--- a/tools/aapt/Main.cpp
+++ b/tools/aapt/Main.cpp
@@ -59,6 +59,7 @@ void usage(void)
" %s p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \\\n"
" [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \\\n"
" [--debug-mode] [--min-sdk-version VAL] [--target-sdk-version VAL] \\\n"
+ " [--ignore-keywords] \\\n"
" [--app-version VAL] [--app-version-name TEXT] [--custom-package VAL] \\\n"
" [--rename-manifest-package PACKAGE] \\\n"
" [--rename-instrumentation-target-package PACKAGE] \\\n"
@@ -138,6 +139,9 @@ void usage(void)
" --debug-mode\n"
" inserts android:debuggable=\"true\" in to the application node of the\n"
" manifest, making the application debuggable even on production devices.\n"
+ " --ignore-keywords\n"
+ " allows to use Java keywords in resource symbols. Set enviroment\n"
+ " variable \"AAPT_IGNORE_KEYWORDS\" can also enable this feature.\n"
" --min-sdk-version\n"
" inserts android:minSdkVersion in to manifest. If the version is 7 or\n"
" higher, the default encoding for resources will be in UTF-8.\n"
@@ -474,6 +478,8 @@ int main(int argc, char* const argv[])
case '-':
if (strcmp(cp, "-debug-mode") == 0) {
bundle.setDebugMode(true);
+ } else if (strcmp(cp, "-ignore-keywords") == 0) {
+ AaptSymbols::setIgnoreKeywords(true);
} else if (strcmp(cp, "-min-sdk-version") == 0) {
argc--;
argv++;
能力值:
( LV12,RANK:240 )
5 楼
楼主辛苦了
能力值:
( LV2,RANK:10 )
6 楼
小白求问如何在windows下编译aapt
能力值:
( LV2,RANK:10 )
7 楼
没有在windows上折腾过。都是在linux上交叉编译,方便快捷。
能力值:
( LV3,RANK:20 )
8 楼
请问是哪个app?
能力值:
( LV12,RANK:240 )
9 楼
weixin啊