还未发布过话题
  • 稍微修正下你的代码:

    package main
    
    import (
        "fmt"
        "flag"
        "github.com/shogo82148/androidbinary/apk"
    )
    
    func main() {
        fileName := flag.String("filename", "", "pkg filename")
        flag.Parse()
    
        pkg, _ := apk.OpenFile(*fileName)
        defer pkg.Close()
        res := ""
    
        pkgName := pkg.PackageName()
        res += pkgName
        res += " "
        verCode := pkg.VersionCode()
        verCodeStr := fmt.Sprintf("%d", verCode)
        res += verCodeStr
        res += " "
        verName := pkg.VersionName()
        res += verName
        res += " "
        appName, _ := pkg.Label(nil)
        res += appName
    
        fmt.Println(res)
    }