diff --git a/src/main/java/android/content/res/AXmlResourceParser.java b/src/main/java/android/content/res/AXmlResourceParser.java old mode 100644 new mode 100755 index 7397749..ac8bc41 --- a/src/main/java/android/content/res/AXmlResourceParser.java +++ b/src/main/java/android/content/res/AXmlResourceParser.java @@ -287,7 +287,10 @@ public String getAttributeValue(int index) { int valueType=m_attributes[offset+ATTRIBUTE_IX_VALUE_TYPE]; if (valueType==TypedValue.TYPE_STRING) { int valueString=m_attributes[offset+ATTRIBUTE_IX_VALUE_STRING]; - return m_strings.getString(valueString); + String value = m_strings.getString(valueString); + if (value != null) { + return value; + } } int valueData=m_attributes[offset+ATTRIBUTE_IX_VALUE_DATA]; return "";//TypedValue.coerceToString(valueType,valueData); diff --git a/src/main/java/com/bigzhao/xml2axml/chunks/AttrChunk.java b/src/main/java/com/bigzhao/xml2axml/chunks/AttrChunk.java old mode 100644 new mode 100755 index 5d4d9e2..8752982 --- a/src/main/java/com/bigzhao/xml2axml/chunks/AttrChunk.java +++ b/src/main/java/com/bigzhao/xml2axml/chunks/AttrChunk.java @@ -1,5 +1,6 @@ package com.bigzhao.xml2axml.chunks; +import android.text.TextUtils; import android.graphics.Color; import com.bigzhao.xml2axml.ComplexConsts; @@ -38,7 +39,7 @@ public void preWrite() { @Override public void writeEx(IntWriter w) throws IOException { - w.write(startTagChunk.stringIndex(null,namespace)); + w.write(startTagChunk.stringIndex(null, TextUtils.isEmpty(namespace) ? null : namespace)); w.write(startTagChunk.stringIndex(namespace,name)); //w.write(-1); if (value.type==ValueType.STRING) diff --git a/src/main/java/com/bigzhao/xml2axml/chunks/StringPoolChunk.java b/src/main/java/com/bigzhao/xml2axml/chunks/StringPoolChunk.java old mode 100644 new mode 100755 index acaaeb6..295a967 --- a/src/main/java/com/bigzhao/xml2axml/chunks/StringPoolChunk.java +++ b/src/main/java/com/bigzhao/xml2axml/chunks/StringPoolChunk.java @@ -222,12 +222,13 @@ public void addString(String namespace, String s){ public int stringIndex(String namespace, String s) { namespace=preHandleString(namespace); s=preHandleString(s); - if (TextUtils.isEmpty(s)) return -1; + if (s == null) return -1; int l=rawStrings.size(); for (int i=0;i