Skip to content Skip to sidebar Skip to footer

File Is Not Recognized After Generating The ".apk" File From Go To Android Using Gomobile Tool

I am working on a project in which i need to generate an APK file form a Golang code base using gomobile tool. the plan is to be able to run it on android tablet. When I install th

Solution 1:

After reviewing this thread. Here is the official go support page. So, I think I need to

  1. move all the files into a directory called assets.
  2. The assets directory is embedding to the ".APK" can be accessed through Android code base.
import "golang.org/x/mobile/asset"  

jsonFile, errOpen := asset.Open(config.json)
if errOpen != nil {
    fmt.Println(errOpen)
}
defer jsonFile.Close()
buf, errRead := ioutil.ReadAll(jsonFile)
if errRead != nil {
    fmt.Println(errRead)
}

Post a Comment for "File Is Not Recognized After Generating The ".apk" File From Go To Android Using Gomobile Tool"