summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2014-05-12 22:13:02 -0700
committer Adam Lesinski <adamlesinski@google.com> 2014-08-21 20:54:01 +0000
commit48f05d29f398576c76b2c3b47a22f4e44e8919fc (patch)
tree6e04ac902663b6ba1371c3c13c77268e9f538f99
parent759f780af0b838316556de69049fb892f7b11ed5 (diff)
Add better error message for AAPT file conflicts
Some resource directories may be the same even though their names are different. For instance, the "smallest width" qualifier was added in API 13, so the resource directory "values-sw600dp" and "values-sw600dp-v13" are the same and cause a conflict. The error reports that this might be the case. Change-Id: Ia35f1d670edd48265b3a7fe3d55656128421f612
-rw-r--r--tools/aapt/AaptAssets.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index eead68c940cf..b44e2d139a95 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -561,15 +561,17 @@ status_t AaptGroup::addFile(const sp<AaptFile>& file, const bool overwriteDuplic
return NO_ERROR;
}
-#if 0
- printf("Error adding file %s: group %s already exists in leaf=%s path=%s\n",
- file->getSourceFile().string(),
- file->getGroupEntry().toDirName(String8()).string(),
- mLeaf.string(), mPath.string());
-#endif
-
- SourcePos(file->getSourceFile(), -1).error("Duplicate file.\n%s: Original is here.",
- getPrintableSource().string());
+ // Check if the version is automatically applied. This is a common source of
+ // error.
+ ConfigDescription withoutVersion = file->getGroupEntry().toParams();
+ withoutVersion.version = 0;
+ AaptConfig::applyVersionForCompatibility(&withoutVersion);
+
+ const sp<AaptFile>& originalFile = mFiles.valueAt(index);
+ SourcePos(file->getSourceFile(), -1)
+ .error("Duplicate file.\n%s: Original is here. %s",
+ originalFile->getPrintableSource().string(),
+ (withoutVersion.version != 0) ? "The version qualifier may be implied." : "");
return UNKNOWN_ERROR;
}