Miroslav DrbalandGitHub 7fcaee440f Merge pull request #8 from avast/fix/resources-drain-leftover
fix: drain leftover bytes in string table, tolerate trailing junk
2026-04-23 14:31:51 +02:00
2023-10-31 12:37:41 +01:00
2018-11-02 10:35:34 +01:00
2025-04-23 09:28:57 +02:00
2025-04-23 09:28:57 +02:00
2017-12-06 14:28:57 +01:00
2020-09-24 12:30:28 +02:00

apkparser

GoDoc Build Status

APK AndroidManifest.xml and resources.arsc parsing.

Works with Go 1.9 or higher.

Documentation on GoDoc

go get github.com/avast/apkparser

ZipReader

Because Android can handle even broken ZIP archives, this packages has it's own zip reader, based on archive/zip.

axml2xml

A tool to extract AndroidManifest.xml and verify APK signature is also part of this repo.

go get github.com/avast/apkparser
go install github.com/avast/apkparser/axml2xml
./axml2xml -v application.apk

Example

package main

import (
	"encoding/xml"
	"fmt"
	"github.com/avast/apkparser"
	"os"
)

func main() {
	enc := xml.NewEncoder(os.Stdout)
	enc.Indent("", "\t")
	zipErr, resErr, manErr := apkparser.ParseApk(os.Args[1], enc)
	if zipErr != nil {
		fmt.Fprintf(os.Stderr, "Failed to open the APK: %s", zipErr.Error())
		os.Exit(1)
		return
	}

	if resErr != nil {
		fmt.Fprintf(os.Stderr, "Failed to parse resources: %s", resErr.Error())
	}
	if manErr != nil {
		fmt.Fprintf(os.Stderr, "Failed to parse AndroidManifest.xml: %s", manErr.Error())
		os.Exit(1)
		return
	}
	fmt.Println()
}
S
Description
APK manifest & resources parsing in Golang.
Readme
283 KiB
Languages
Go 99.9%
Shell 0.1%