iBotPeaches/Apktool · error · AndrolibException
Could not decode raw stream.
Error message
Could not decode raw stream.
What it means
Thrown by ResRawStreamDecoder.decode() when IOUtils.copy(in, out) fails with an IOException while copying a raw (undecoded) resource file. This decoder is the pass-through used for assets and files with no special format (Type.UNKNOWN), so any read error on the source zip entry or write error on the destination file lands here, wrapped in AndrolibException.
Source
Thrown at brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResRawStreamDecoder.java:33
* limitations under the License.
*/
package brut.androlib.res.decoder;
import brut.androlib.exceptions.AndrolibException;
import org.apache.commons.io.IOUtils;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
public class ResRawStreamDecoder implements ResStreamDecoder {
@Override
public void decode(InputStream in, OutputStream out) throws AndrolibException {
try {
IOUtils.copy(in, out);
} catch (IOException ex) {
throw new AndrolibException("Could not decode raw stream.", ex);
}
}
}
View on GitHub (pinned to 79b63384d7)
Solutions
- Check disk space and write permissions on the output directory before decoding.
- Verify the APK zip integrity (unzip -t) and re-download if entries are corrupt.
- Do not touch or re-sign the APK while a decode is running.
- If the entry is intentionally corrupt, catch AndrolibException per file and skip it (apktool's public ResFileDecoder path already substitutes ResPrimitive.NULL with a warning).
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure output target is writable and disk has space before decode
Files.createDirectories(outDir);
if (outDir.toFile().getFreeSpace() < apkLength) throw new IOException("Insufficient disk space"); Try / catch
try {
decoder.decode(in, out);
} catch (AndrolibException ex) {
if (ex.getCause() instanceof IOException) {
// source entry unreadable or destination unwritable; skip file with warning
}
} Prevention
- Pre-flight check disk space and output permissions
- Validate zip entry CRCs before decode
- Do not modify or move the APK mid-decode
When it happens
Trigger: A truncated or CRC-corrupt zip entry for the resource file; the output directory being unwritable or full; the source APK being modified/deleted mid-decode; streams closed externally.
Common situations: Disk-full during apktool d; read-only or permission-restricted output dirs; APKs with deliberately corrupted entries (anti-tamper); network drives dropping during decode.
Related errors
- Error while skipping chunk.
- Error while skipping chunk header.
- Legacy aapt is no longer supported.
- Could not generate:
- Could not decode arsc file.
AI-assisted analysis of iBotPeaches/Apktool@79b63384d7 (2026-08-14).
Data as JSON: /api/errors/af02ce18c76f387e.
Report an issue: GitHub.