我正试图从我的go程序中为android生成一个绑定,但是gomobile给了我一个错误,因为
no exported names in the package "src/github.com/rohankeskar19/android_whisper"这是我使用的命令
gomobile bind -v -target=android -o ethereumchat.aar src\github.com\rohankeskar19\android_whisper\这是我的文件夹结构
bin
pkg
src
|
-github.com/
|
-rohankeskar19/
|
-android_whisper/
|
-ethereumchat.go我知道为了出口名字,他们必须以大写字母开头。
这是我的代码
package ethereumchat
import (
"log"
"context"
"fmt"
"github.com/ethereum/go-ethereum/whisper/shhclient"
)
func Newkeypair(address string) string {
client, err := shhclient.Dial(address)
if err != nil{
log.Fatal(err)
return "Error occured while connecting to whisper"
}
keyID, err := client.NewKeyPair(context.Background())
if err != nil {
log.Fatal(err)
return "Error occured while creating key pair"
}
return keyID
}发布于 2020-03-15 09:19:18
将包的名称与其所在文件夹使用相同的名称。(您的包是ethereumchat,但是目录是andorid_whisper。)
https://stackoverflow.com/questions/60690727
复制相似问题