apk

package
v0.0.0-...-7ee513c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package apk provides methods to get information (e.g. manifests, ABIs) from APKs, as well as taking an APK and making it debuggable, for testing purposes.

Index

Constants

View Source
const (
	ErrMissingManifest = fault.Const("Couldn't find APK's manifest file.")
	ErrInvalidAPK      = fault.Const("File is not an APK.")
)

Variables

This section is empty.

Functions

func GatherABIs

func GatherABIs(files []*zip.File) []*device.ABI

GatherABIs returns the list of ABI directories in the zip file.

func GetManifest

func GetManifest(ctx context.Context, files []*zip.File) (manifest.Manifest, error)

func GetManifestXML

func GetManifestXML(ctx context.Context, files []*zip.File) (string, error)

func IsApkDebuggable

func IsApkDebuggable(ctx context.Context, apk string) (bool, error)

func Read

func Read(ctx context.Context, apkData []byte) ([]*zip.File, error)

Read parses the APK file, returning its contents.

Types

type ApkDebugifier

type ApkDebugifier struct {
	JarSignCmd   string // path to the jarsigner binary
	ZipAlignCmd  string // path to the zipalign binary
	KeyPass      string // key passphrase
	KeyAlias     string // key alias for signing
	StorePass    string // keystore passphrase
	KeyStorePath string // path to keystore (e.g. /path/to/debug.keystore)
}

ApkDebugifier makes an APK debuggable. The fields in the struct are used to configure the various paths and passwords required, as well as providing a log context. Intended use is ApkDebugifier{Ctx: ..., JarSignCmd: "jarsigner", ..., KeyStorePath: "..."}.Run(...).

func (ApkDebugifier) Run

func (a ApkDebugifier) Run(ctx context.Context, src string, dst string) error

Run takes the path (src) to an APK, sets the debuggable flag in its manifest, re-signs and aligns it, and saves it to a different path (dst).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL