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

why when I fyne package the android app . the app name always is org.golang.app.GoNativeActivity #665

Closed
zhzhyu opened this issue Feb 9, 2020 · 24 comments
Labels
question A question has been asked

Comments

@zhzhyu
Copy link

zhzhyu commented Feb 9, 2020

Describe the bug:

To Reproduce:

Steps to reproduce the behaviour:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Screenshots:

Example code:

Device (please complete the following information):

  • OS: [e.g. Linux, MacOS or iOS]
  • Version: [e.g. 22]
  • Go version: [e.g. 1.12.3]
  • Fyne version: [e.g. 1.2.0 or git SHA]
    I had sitting androidmainfest.xml android:label,but mybe never use it
@zhzhyu
Copy link
Author

zhzhyu commented Feb 9, 2020

No matter how I set androidmanifest.xml,the app name never change,always is "org.golang.app.GoNativeActivity"

@andydotxyz
Copy link
Member

There are improvements to this on release/v1.2.3 branch (not released yet) would you be able to test that version as well?

@zhzhyu
Copy link
Author

zhzhyu commented Feb 9, 2020

There are improvements to this on release/v1.2.3 branch (not released yet) would you be able to test that version as well?
Can you tell me when the new will release

@zhzhyu
Copy link
Author

zhzhyu commented Feb 10, 2020

Can you tell me when the new will release

@andydotxyz
Copy link
Member

We don't have a schedule yet - probably in a week or two.
It would be helpful if you could test before release so we can verify it fixes your issue

@andydotxyz
Copy link
Member

Actually hold on - this is the name of the main activity, not the name of the app.
Can you please explain where you are seeing this used as the app name?

@zhzhyu
Copy link
Author

zhzhyu commented Feb 10, 2020

We don't have a schedule yet - probably in a week or two.
It would be helpful if you could test before release so we can verify it fixes your issue

I am very willing to test in advance. Could you send me an email? Thank you very much

@zhzhyu
Copy link
Author

zhzhyu commented Feb 10, 2020

We don't have a schedule yet - probably in a week or two.
It would be helpful if you could test before release so we can verify it fixes your issue

[email protected]

@zhzhyu
Copy link
Author

zhzhyu commented Feb 10, 2020

Actually hold on - this is the name of the main activity, not the name of the app.
Can you please explain where you are seeing this used as the app name?

It's on the android home screen,app name
Screenshot_20200210_202818

@andydotxyz
Copy link
Member

Can you confirm the package command you are using and the name of the directory you are building in?

@andydotxyz andydotxyz added the question A question has been asked label Feb 11, 2020
@zhzhyu
Copy link
Author

zhzhyu commented Feb 12, 2020

Can you confirm the package command you are using and the name of the directory you are building in?

yes I can

@andydotxyz
Copy link
Member

Apologies, I meant can you please tell us what package command you are using, and what the directory name is that you are building in.

@ffdfgdfg
Copy link

ffdfgdfg commented Mar 6, 2020

I tested version 1.2.3 without custom AndroidManifest.xml file, it works fine.
But our app needs internet permission, so I need to use a custom manifest file.
In version 1.2.3, I found there are some updates with manifest template

var manifestTmpl = template.Must(template.New("manifest").Parse(`

I follow this template and change my manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest
        xmlns:android="http://schemas.android.com/apk/res/android"
        package="org.nps.client"
        android:versionCode="1"
        android:versionName="0.26.5">

    <uses-permission android:name="android.permission.INTERNET"/>
    <application android:label="Npc" android:debuggable="true">
        <activity android:name="org.golang.app.GoNativeActivity"
                  android:label="Npc"
                  android:configChanges="orientation|keyboardHidden">
            <meta-data android:name="android.app.lib_name" android:value="npc"/>
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

But when I build it, use a script

cd /go
apt-get install libegl1-mesa-dev libgles2-mesa-dev libx11-dev -y
go get -u fyne.io/fyne/cmd/fyne fyne.io/fyne
echo "fyne install success"
mkdir -p /go/src/ehang.io/nps
cp -R /app/* /go/src/ehang.io/nps
cd /go/src/ehang.io/nps
rm cmd/npc/sdk.go
echo "tidy success"
cd /go/src/ehang.io/nps
go mod vendor
cd vendor
cp -R * /go/src
cd ..
rm -rf vendor
echo "vendor success"
cd gui/npc
fyne package -appID org.nps.client -os android -icon ../../docs/logo.png
mv npc.apk /app/android_client.apk
echo "android build success"

with this manifest file, it shows the problem.

@andydotxyz
Copy link
Member

Hmm. The package should not be altering a custom manifest - perhaps you can get a copy of the manifest from the packaged application and compare? That would probably be most helpful at this stage

@ffdfgdfg
Copy link

ffdfgdfg commented Mar 7, 2020

Yes, I find the question where is.
I use aapt to phase the apk manifest file
without custom manifest here is

N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=2)
    A: android:versionCode(0x0101021b)=(type 0x10)0x1
    A: android:versionName(0x0101021c)="1.0" (Raw: "1.0")
    A: package="org.nps.client" (Raw: "org.nps.client")
    A: platformBuildVersionCode=(type 0x10)0xf
    A: platformBuildVersionName="4.0.4-1406430" (Raw: "4.0.4-1406430")
    E: uses-sdk (line=2)
      A: android:minSdkVersion(0x0101020c)=(type 0x10)0xf
      A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
    E: application (line=8)
      A: android:icon(0x01010002)=@0x7f020000
      A: android:label(0x01010001)="Npc" (Raw: "Npc")
      A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
      E: activity (line=9)
        A: android:label(0x01010001)="Npc" (Raw: "Npc")
        A: android:name(0x01010003)="org.golang.app.GoNativeActivity" (Raw: "org.golang.app.GoNativeActivity")
        A: android:configChanges(0x0101001f)=(type 0x11)0xa0
        E: meta-data (line=12)
          A: android:name(0x01010003)="android.app.lib_name" (Raw: "android.app.lib_name")
          A: android:value(0x01010024)="npc" (Raw: "npc")
        E: intent-filter (line=13)
          E: action (line=14)
            A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
          E: category (line=15)
            A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")

With custom manifest file on previous reply

N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=2)
    A: android:versionCode(0x0101021b)=(type 0x10)0x1
    A: android:versionName(0x0101021c)="0.26.5" (Raw: "0.26.5")
    A: package="org.nps.client" (Raw: "org.nps.client")
    A: platformBuildVersionCode=(type 0x10)0xf
    A: platformBuildVersionName="4.0.4-1406430" (Raw: "4.0.4-1406430")
    E: uses-sdk (line=2)
      A: android:minSdkVersion(0x0101020c)=(type 0x10)0xf
      A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
    E: uses-permission (line=8)
      A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
    E: application (line=9)
      A: android:icon(0x01010002)=@0x7f020000
      A: android:label(0x01010001)="Npc" (Raw: "Npc")
      A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
      E: activity (line=10)
        A: android:name(0x01010003)="org.golang.app.GoNativeActivity" (Raw: "org.golang.app.GoNativeActivity")
        A: android:label(0x01010001)="Npc" (Raw: "Npc")
        A: android:configChanges(0x0101001f)=(type 0x11)0xa0
        E: meta-data (line=13)
          A: android:name(0x01010003)="android.app.lib_name" (Raw: "android.app.lib_name")
          A: android:value(0x01010024)="npc" (Raw: "npc")
        E: intent-filter (line=14)
          E: action (line=15)
            A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
          E: category (line=16)
            A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")

It show's android:name and android:label where places swapped
Also I removed the android.permission.INTERNET option, and find it just fine.
So I move the android.permission.INTERNET option to behind the application like this

<?xml version="1.0" encoding="utf-8"?>
<manifest
        xmlns:android="http://schemas.android.com/apk/res/android"
        package="org.nps.client"
        android:versionCode="1"
        android:versionName="0.26.5">

    <application android:label="Npc" android:debuggable="true">
        <activity android:name="org.golang.app.GoNativeActivity"
                  android:label="Npc"
                  android:configChanges="orientation|keyboardHidden">
            <meta-data android:name="android.app.lib_name" android:value="npc"/>
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
    <uses-permission android:name="android.permission.INTERNET"/>
</manifest>

It works

N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=2)
    A: android:versionCode(0x0101021b)=(type 0x10)0x1
    A: android:versionName(0x0101021c)="0.26.5" (Raw: "0.26.5")
    A: package="org.nps.client" (Raw: "org.nps.client")
    A: platformBuildVersionCode=(type 0x10)0xf
    A: platformBuildVersionName="4.0.4-1406430" (Raw: "4.0.4-1406430")
    E: uses-sdk (line=2)
      A: android:minSdkVersion(0x0101020c)=(type 0x10)0xf
      A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
    E: application (line=8)
      A: android:icon(0x01010002)=@0x7f020000
      A: android:label(0x01010001)="Npc" (Raw: "Npc")
      A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
      E: activity (line=9)
        A: android:label(0x01010001)="Npc" (Raw: "Npc")
        A: android:name(0x01010003)="org.golang.app.GoNativeActivity" (Raw: "org.golang.app.GoNativeActivity")
        A: android:configChanges(0x0101001f)=(type 0x11)0xa0
        E: meta-data (line=12)
          A: android:name(0x01010003)="android.app.lib_name" (Raw: "android.app.lib_name")
          A: android:value(0x01010024)="npc" (Raw: "npc")
        E: intent-filter (line=13)
          E: action (line=14)
            A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
          E: category (line=15)
            A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
    E: uses-permission (line=19)
      A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")

Tested on my phone, just show the correct app name
Thanks

@andydotxyz
Copy link
Member

Wow, so the attribute order seems to be the problem?

@ffdfgdfg
Copy link

ffdfgdfg commented Mar 7, 2020

That's it, the order

@andydotxyz
Copy link
Member

Perhaps this is related to the device or android version? Do you see the issue on emulator or any other devices?

@ffdfgdfg
Copy link

ffdfgdfg commented Mar 7, 2020

My phone is android 9, nokia8, and the issue in my repo tell me his phone is huawei, android 9, but not tested on and emulator, you can download this and test it.

@pymq
Copy link
Contributor

pymq commented Mar 7, 2020

Can confirm the same behavior in my app on android 8.0.
Changing order helps, thanks @ffdfgdfg

@andydotxyz
Copy link
Member

Thank you for all this. I checked the android spec and cannot find anything that should imply this behaviour - the “label” field should always be used not the “name”. I suspect the package code must be mid-reading it somehow... will look into it further

@andydotxyz
Copy link
Member

It would be great if you could check the upcoming 1.2.4 release (currently on release/v1.2.4 branch) and see if the behaviour is changed or fixed...

@ffdfgdfg
Copy link

I tested the 1.2.4 release, behavior not changed, order still effect.

@andydotxyz
Copy link
Member

I cannot explain why this is happening, but the manifest in 1.4.1 (release date to be set) will include a permissions section, so it should illustrate that others go there too.
Hopefully that is sufficient to close this issue, sorry it's not a cleaner fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A question has been asked
Projects
None yet
Development

No branches or pull requests

4 participants