Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: javac encoding error during build #46381

Open
Jambo-Git opened this issue May 26, 2021 · 3 comments
Open

x/mobile: javac encoding error during build #46381

Jambo-Git opened this issue May 26, 2021 · 3 comments
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@Jambo-Git
Copy link

Jambo-Git commented May 26, 2021

What version of Go are you using (go version)?

$ go version
1.14

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

PWD=$WORK\java javac -d $WORK\javac-output -source 1.7 -target 1.7 -bootclasspath $ANDROID_HOME\platforms\android-30\android.jar common\Common.java common\Context.java common\DaqContext.java common\User.java go\Seq.java go\Universe.
java go\error.java
警告: [options] 源值7已过时, 将在未来所有发行版中删除
警告: [options] 目标值7已过时, 将在未来所有发行版中删除
警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。
common\User.java:36: 错误: 编码 GBK 的不可映射字符 (0xB9)
         * 鐢ㄦ埛鍚嶏紝鍙慨鏀?
                     ^
common\User.java:40: 错误: 编码 GBK 的不可映射字符 (0xB9)
         * 鐢ㄦ埛鍚嶏紝鍙慨鏀?
                     ^
@Jambo-Git
Copy link
Author

Jambo-Git commented May 26, 2021

i change: golang.org\x\mobile\cmd\gomobile\bind_androidapp.go; line 308 add "-encoding","utf-8"
args := []string{
"-d", dst,
"-source", javacTargetVer,
"-target", javacTargetVer,
"-encoding","utf-8",
"-bootclasspath", bClspath,
}

@mknyszek mknyszek added this to the Backlog milestone May 26, 2021
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 26, 2021
@mknyszek mknyszek changed the title gomobile build javac encoding error x/mobile: javac encoding error during build May 26, 2021
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label May 26, 2021
@mknyszek
Copy link
Contributor

I see, it looks like javac doesn't like the encoding of the files gomobile generates. Looks like we just put in UTF-8 strings wholesale, but Java strings aren't UTF-8. And it appears OP fixed it by adding -encoding utf-8 to the list of arguments passed to javac.

CC @hyangah via https://dev.golang.org/owners

@mknyszek
Copy link
Contributor

@Jambo-Git would you be willing to send a PR to https://github.com/golang/mobile, since you already figured it out? (See https://golang.org/doc/contribute for how to contribute.)

If you're not interested in sending a patch, I can send a patch for this later this week.

@mknyszek mknyszek modified the milestones: Backlog, Unreleased May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants