Thanks for getting back.

I finally got it to work after some experimentation on test project. 

Solution
Added tag android for android only file and named it with suffix _android
// +build android
And for linux only file added
// +build !android

Below env are set as mentioned earlier
GOOS=android
GOARCH=arm

And build command used is 
go build --tags android <main_package>


Build constraint line is added at the top of the file followed by a blank 
line.

They don't work if I add them after copyright header (block comment) with 
preceding and following blank line. 
May be only line comments are allowed above the build constraint line as 
mentioned on official page <https://golang.org/pkg/go/build/> and not block 
comments.
Constraints may appear in any kind of source file (not just Go), but they 
must appear near the top of the file, preceded only by blank lines and 
other line comments. These rules mean that in Go files a build constraint 
must appear before the package clause.



On Friday, February 2, 2018 at 2:26:28 AM UTC+5:30, Hyang-Ah Hana Kim wrote:
>
> Partly true.
> Build tags like !android should prevent inclusion of the file.
> Files named with _android suffix or with android buildtag should be 
> included only for android.
>
> https://go.googlesource.com/go/+/master/src/time/zoneinfo_android.go
> https://go.googlesource.com/go/+/master/src/time/zoneinfo_unix.go#5
>
> On Thu, Feb 1, 2018 at 2:40 PM, Dave Cheney <da...@cheney.net 
> <javascript:>> wrote:
>
>> The build system considers android and Linux to be the same for 
>> historical reasons.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> __
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to