android

73 views
Skip to first unread message

Тэй

unread,
Mar 10, 2024, 6:40:49 AM3/10/24
to Cogent Core
Hi. I tryed to build "Hello World" app for Android (I copied source from docs on Cogent Core site). I used "core build -t android" command. There was an .apk built as a result (about 100 Mb size). Then I've installed it on my phone (redmi 9c nfc) and launched it. It showed black screen and did nothing.

1. What I did wrong?
2. I think it's size is too big for simple "Hello world" app. Is there a way to decrease it?

P.S. Cogent Core is very interesting framework. Looks comfortable to use it. But it's very important for me to build apps for mobile.

Kai O'Reilly

unread,
Mar 10, 2024, 1:38:38 PM3/10/24
to Cogent Core
I agree that mobile is very important, and I will work on reducing the binary size of the compiled apk. For the black screen, can you send me the output you get when you run `core run android -d`?

Тэй

unread,
Mar 11, 2024, 5:51:12 PM3/11/24
to Cogent Core
I used this command `core run android -d -v`


Result:
"...
Performing Streamed Install
adb: failed to install bin\android\Hw.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
core run failed: error installing app: failed to run "adb install -r bin\android\Hw.apk: exit status 1"
"
воскресенье, 10 марта 2024 г. в 20:38:38 UTC+3, Kai O'Reilly:

Тэй

unread,
Mar 11, 2024, 6:04:40 PM3/11/24
to Cogent Core
processor architecture for my phone is "arm64-v8a" 

вторник, 12 марта 2024 г. в 00:51:12 UTC+3, Тэй:

Kai O'Reilly

unread,
Mar 11, 2024, 6:30:21 PM3/11/24
to Cogent Core
I fixed an issue with the default architecture when running on mobile. Can you install the latest version of the core tool and then run `core run android -d -v` again?

Тэй

unread,
Mar 12, 2024, 10:25:15 AM3/12/24
to Cogent Core
installed core:
go: downloading cogentcore.org/core v0.0.8-0.20240312043521-bdafc24c3306

and then:
core run android -d -v
GOMOBILE=C:\Users\Lenovo\go\pkg\gomobile
WORK=C:\Users\Lenovo\AppData\Local\Temp\gomobile-work-4146767687
mkdir -p "C:\\Users\\Lenovo\\AppData\\Local\\Temp\\gomobile-work-4146767687\\lib\\arm64-v8a"
go env GOMODCACHE
C:\Users\Lenovo\go\pkg\mod
go build -tags debug -v -buildmode=c-shared -ldflags  -X cogentcore.org/core/goosi.CoreVersion=v0.0.7 -o C:\Users\Lenovo\AppData\Local\Temp\gomobile-work-4146767687\lib\arm64-v8a\libHw.so hw
apk: classes.dex

apk: lib/arm64-v8a/libHw.so

apk: res/mipmap-xxxhdpi-v4/icon.png

apk: resources.arsc

apk: AndroidManifest.xml

rm -rf "C:\\Users\\Lenovo\\AppData\\Local\\Temp\\gomobile-work-4146767687"

adb install -r bin\android\Hw.apk
Performing Streamed Install
adb: failed to install bin\android\Hw.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
core run failed: error installing app: failed to run "adb install -r bin\android\Hw.apk: exit status 1"

the same result for now.

вторник, 12 марта 2024 г. в 01:30:21 UTC+3, Kai O'Reilly:

Kai O'Reilly

unread,
Mar 12, 2024, 10:43:45 AM3/12/24
to Cogent Core
That suggests that the architecture of your phone is not actually arm64. You can manually specify the architecture like this: `core run android/{arch} -d -v`, so you should try that with all of the different possible architectures (arm, arm64, amd, amd64). Also, I just remembered why the .apk file is so big: by default, for the `core build` command (not the `core run` command), it makes a "fat" apk that contains binaries for all of the different architectures, which is why you were able to install it onto your device but also why it is so big. The `core run` and `core install` commands optimize by only building it for one architecture, since you are immediately running/installing it on a specific device. So, please figure out the true architecture of your device or try all of the different architectures and then send me the output of the run command again. Thanks!

Тэй

unread,
Mar 13, 2024, 7:52:19 AM3/13/24
to Cogent Core
Yes, you're right. I 've Installed an app for detailed info about processor: armeabi-v7a

I used `core run android/arm -d -v` and took a step forward.

When it was at line 6 in source code main.go `b := gi.NewBody("Hello")
it crashed after a try to mkdir /data/data/Hello
My phone is not rooted, so this folder is not available for this app
I changed source to `b := gi.NewBody("com.go.hw/Hello")`
and it crashed and wrtitten to log file this:

"
angelican:/data/data/com.go.hw/Hello/crash-logs $ cat crash_2024-03-13_14-36-21
Platform: Android
System platform: Android
App version: dev
Core version: v0.0.7
Time: 2024-03-13 14:36:21

panic: vulkan error: vulkan error: feature not present (-8)

goroutine 17 [running, locked to thread]:
runtime/debug.Stack()
        C:/Program Files/Go/src/runtime/debug/stack.go:24 +0x80
cogentcore.org/core/goosi.HandleRecoverBase({0xbf6a3ae8, 0x8e094148})
        C:/Users/Lenovo/go/pkg/mod/cogentcore.org/co...@v0.0.7/goosi/recover.go:49 +0x24
cogentcore.org/core/gi.HandleRecover({0xbf6a3ae8, 0x8e094148})
        C:/Users/Lenovo/go/pkg/mod/cogentcore.org/co...@v0.0.7/gi/recover.go:32 +0x48
cogentcore.org/core/goosi/driver/android.(*App).SetSystemWindow.func1()
        C:/Users/Lenovo/go/pkg/mod/cogentcore.org/co...@v0.0.7/goosi/driver/android/app.go:98 +0x44
panic({0xbf6a3ae8, 0x8e094148})
        C:/Program Files/Go/src/runtime/panic.go:770 +0x110
cogentcore.org/core/vgpu.IfPanic(...)
        C:/Users/Lenovo/go/pkg/mod/cogentcore.org/co...@v0.0.7/vgpu/errors.go:39
cogentcore.org/core/vgpu.(*Device).MakeDevice(0x8e0a6234, 0x8e1f6008)
        C:/Users/Lenovo/go/pkg/mod/cogentcore.org/co...@v0.0.7/vgpu/device.go:98 +0x27c
cogentcore.org/core/vgpu.(*Surface).Init(0x8e0a6230, 0x8e1f6008, 0xe3cba2f0)
        C:/Users/Lenovo/go/pkg/mod/cogentcore.org/co...@v0.0.7/vgpu/surface.go:118 +0x1d4
cogentcore.org/core/vgpu.NewSurface(0x8e1f6008, 0xe3cba2f0)
        C:/Users/Lenovo/go/pkg/mod/cogentcore.org/co...@v0.0.7/vgpu/surface.go:68 +0x54
cogentcore.org/core/goosi/driver/android.(*App).SetSystemWindow(0xbfc0f198, 0xd5018008)
        C:/Users/Lenovo/go/pkg/mod/cogentcore.org/co...@v0.0.7/goosi/driver/android/app.go:106 +0xc0
cogentcore.org/core/goosi/driver/android.onNativeWindowCreated(0xeb8cf620, 0xd5018008)
        C:/Users/Lenovo/go/pkg/mod/cogentcore.org/co...@v0.0.7/goosi/driver/android/android.go:160 +0x9c
"
вторник, 12 марта 2024 г. в 17:43:45 UTC+3, Kai O'Reilly:

Тэй

unread,
Mar 13, 2024, 8:00:07 AM3/13/24
to Cogent Core
Infromation about Vulkan on my phone:
API version: 1.1.100
Driver Version: 0x52ca1d
Device Name: PowerVR Rogue GE8320

среда, 13 марта 2024 г. в 14:52:19 UTC+3, Тэй:

Kai O'Reilly

unread,
Mar 13, 2024, 10:55:22 AM3/13/24
to Cogent Core
Thank you for the information. I will work on resolving the data directory issue and the Vulkan issue.

Kai O'Reilly

unread,
Mar 14, 2024, 4:07:07 PM3/14/24
to Cogent Core
Regarding the Vulkan issue, I am planning to add support for running apps using non-Vulkan graphics within the next couple of weeks, so that should fix the problem, given that your Android device does not seem to support the Vulkan features we need. In the meantime, you can test your app on your phone's browser by running `core run web` on your computer and then going to http://[the local IP address of your computer; you can google how to find it]:8080. Again, we will definitely support running apps directly on phones with poor Vulkan support soon, and that is just a temporary workaround you can do if you want.  

Тэй

unread,
Mar 17, 2024, 12:44:27 PM3/17/24
to Cogent Core
Thank you. I'll wait for changes you are planning.

четверг, 14 марта 2024 г. в 23:07:07 UTC+3, Kai O'Reilly:
Reply all
Reply to author
Forward
0 new messages