dsgdfh302506 2019-08-02 11:49
浏览 89

Android Framework无法使用gomobile绑定进行编译

We are facing a compilation issue when we try to compile an AAR version of our framework with gomobile bind. It's binding fine with the iOS Framework.

Here is the error we get:

$ make build_android

cd ./gomobile/logger && gomobile bind -o ../build/logger.aar -target=android . ../levelenum ../remotelogger ../apiclient ../userproperties

gomobile: javac -d /var/folders/p6/vvxrsdbj1bg87kkgk3k77cn40000gp/T/gomobile-work-357624003/javac-output -source 1.7 -target 1.7 -bootclasspath /Users/robin/Library/Android/sdk/platforms/android-29/android.jar apiclient/Apiclient.java apiclient/AuthenticationArgs.java apiclient/PostArgs.java go/Seq.java go/Universe.java go/error.java levelenum/Level.java levelenum/Levelenum.java logger/Logger.java logger/Logger_.java remotelogger/Remotelogger.java userproperties/ApplicationProperties.java userproperties/CarrierProperties.java userproperties/DeviceProperties.java userproperties/NetworkProperties.java userproperties/OSProperties.java userproperties/Userproperties.java failed: exit status 1
apiclient/Apiclient.java:12: error: class APIClient is public, should be declared in a file named APIClient.java
public final class APIClient implements Seq.Proxy {
             ^
remotelogger/Remotelogger.java:12: error: class RemoteLogger is public, should be declared in a file named RemoteLogger.java
public final class RemoteLogger implements Seq.Proxy {
             ^
userproperties/Userproperties.java:12: error: class UserProperties is public, should be declared in a file named UserProperties.java
public final class UserProperties implements Seq.Proxy {
             ^
./apiclient/Apiclient.java:12: error: class APIClient is public, should be declared in a file named APIClient.java
public final class APIClient implements Seq.Proxy {
             ^
apiclient/Apiclient.java:13: error: cannot access Apiclient
        static { Apiclient.touch(); }
                 ^
  bad source file: ./apiclient/Apiclient.java
    file does not contain class apiclient.Apiclient
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
5 errors

make: *** [build_android] Error 1

For instance our APIClient.go file looks like this:

package apiclient

import (
    "bytes"
    "fmt"
    "io/ioutil"
    "log"
    "net/http"
    "time"
)

// APIClient : handler of the Network request
type APIClient struct {
    BaseURL string
}

And the folder structure is:

gomobile/
    Makefile
    go.mod
    go.sum
    build/
        logger.framework (iOS)
        logger.aar (Android) <---- Should be here but cannot be built
    apiclient/
        apiclient.go
    logger/
        logger.go
    userproperties/
        userproperties.go
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 求数学坐标画圆以及直线的算法
    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决