4

I have a networking app, written in Go. Since Go 1.5 I can build it also for android devices with almost no changes using gomobile working fine.

But I can't change default android icon of app.

I'm building app with custom manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="name.app" android:installLocation="auto"
 android:versionCode="1" android:versionName="1.0-alpha">
    <uses-sdk android:minSdkVersion="9" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />

    <application android:label="name.app" android:debuggable="true" android:icon="@assets/ic_launcher" android:persistent="true">
        <activity android:name="org.golang.app.GoNativeActivity" android:configChanges="orientation|keyboardHidden"
         android:alwaysRetainTaskState="true" android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="android.app.lib_name" android:value="name.app" />
        </activity>
    </application>
</manifest>

and trying to place icon png file(s) in assets subdirectory:

.
├── *.go
├── AndroidManifest.xml
└── assets
    ├── drawable-hdpi
    │   └── ic_launcher.png
    ├── drawable-mdpi
    │   └── ic_launcher.png
    ├── drawable-xhdpi
    │   └── ic_launcher.png
    ├── drawable-xxhdpi
    │   └── ic_launcher.png
    ├── drawable-xxxhdpi
    │   └── ic_launcher.png
    └── ic_launcher.png

Instead of android:icon="@assets/ic_launcher" I've also tried android:icon="@drawable/ic_launcher" and android:icon="@assets/drawable/ic_launcher" without any results.

Any solution?

note: gomobile have only assets directory as a place for custom files.

saurabh
  • 724
  • 3
  • 17
sisoft
  • 953
  • 10
  • 22
  • Have you tried to create a ```res``` folder and put your drawable folders in there? – user2172816 Sep 23 '15 at 09:10
  • Yes, but gomibile ignores it and not add to apk. Also tried path `assets/res/drawable-*/`. – sisoft Sep 23 '15 at 11:05
  • Is there an answer to this question? @sisoft Have you tried putting them in the `mipmap` folder? – Topo Aug 01 '16 at 21:32
  • 2
    @Topo: it don't work too. As I found, icon support added in https://golang.org/cl/30019, but this patchset is not in main git tree yet. – sisoft Nov 19 '16 at 15:15

0 Answers0