Use a package rename for one of the imports:

import sapp "android.support.v7.app.AppCompatActivity"

And then use "sapp" for the support library app Java package.

- Elias
man. 19. dec. 2016 kl. 06.59 skrev andrey mirtchovski <mirtchov...@gmail.com
>:

> The main activity in the reverse example uses a
> support/v7/app.AppCompatActivity (as it should), however if I want to add
> an app.Service service to the android app gomobile encounters duplicate
> import errors:
>
>    gomobile_bind/go_appmain.go:20: app redeclared as imported package name
>
> If I attempt to resolve this by renaming v7/app gomobile still complains:
>
>    gomobile_bind/go_appmain.go:31: undefined:
> "Java/android/support/v7/app".Service
>
> (I suspect it doesn't propagate the rename, but I have not yet looked at
> the generated code).
>
> Essentially I have two files (activity.go and service.go) which each
> import something called "app", one from android.support.v7.app, the other
> from android.app... I can successfully refactor the service into a separate
> package but then I'm only allowed to use one package name in the manifest
> and I don't see how I can reference the second package by name.
>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android";
> package="go.app" >
> <application
> android:label="MyApp"
> <activity
> android:name=".MainActivity">   <!-- package app -->
> </activity>
> <service android:name=".MainService">   <!-- package service, or
> app/service? -->
> </service>
> </application>
> </manifest>
>

-- 
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