Skip to content

Commit 8288c13

Browse files
committed
Fixing runtime issues on Android (x64-Emulator) [skip ci]
* Fixed threads platform feature was missing AIOPort object. * Fixed aligned allocation. (might need more reading in the docs) * Fixed various missing-symbol errors at runtime. * Added new flag to check for missing symbols during linking. * Added compiletime check for URI parsing. * Updated the Android project gradle templates and values. * Updated Android to NDK28 * Retargeted API level to 35
1 parent 99dc4e0 commit 8288c13

File tree

14 files changed

+47
-11
lines changed

14 files changed

+47
-11
lines changed

source/code/core/memsys/private/mem.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace ice
4646
.size = size,
4747
.alignment = alignment,
4848
};
49-
#elif ISP_LINUX || ISP_WEBAPP || (ISP_ANDROID && ISP_ANDROID <= 29)
49+
#elif ISP_LINUX || ISP_WEBAPP || (ISP_ANDROID && ISP_ANDROID <= 35)
5050
void* memory_location;
5151

5252
[[maybe_unused]]

source/code/core/tasks/private/task_thread_utils.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/// Copyright 2025 - 2025, Dandielo <[email protected]>
2+
/// SPDX-License-Identifier: MIT
3+
14
#include <ice/task_thread_utils.hxx>
25
#include <ice/os/windows.hxx>
36
#include <ice/os/unix.hxx>

source/code/core/tasks/public/ice/task_thread_utils.hxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/// Copyright 2025 - 2025, Dandielo <[email protected]>
2+
/// SPDX-License-Identifier: MIT
3+
14
#pragma once
25
#include <ice/base.hxx>
36
#include <ice/clock_types.hxx>

source/code/core/utils/private/config/config_builder_types.hxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "config_internal.hxx"
66
#include <ice/config/config_builder.hxx>
77
#include <ice/string/heap_var_string.hxx>
8+
#include <ice/string/heap_string.hxx>
89
#include <ice/container/array.hxx>
910

1011
namespace ice::config::detail

source/code/example/android/simple/build.gradle.template.kts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ android {
1010

1111
namespace = "$(Namespace)"
1212

13+
// Defines the NDK version to be used for this project
14+
ndkVersion = "$(NDKVersion)"
15+
1316
defaultConfig {
1417

1518
// Uniquely identifies the package for publishing.
@@ -27,6 +30,10 @@ android {
2730

2831
// Defines a user-friendly version name for your app.
2932
versionName = "$(VersionName)"
33+
34+
compileOptions {
35+
targetCompatibility = JavaVersion.VERSION_11
36+
sourceCompatibility = JavaVersion.VERSION_11
3037
}
3138

3239
buildTypes {
@@ -51,6 +58,10 @@ android {
5158

5259
$(ProjectJNISources)
5360
}
61+
62+
lint {
63+
baseline = file("lint-baseline.xml")
64+
}
5465
}
5566

5667
afterEvaluate {
@@ -84,6 +95,6 @@ afterEvaluate {
8495
}
8596

8697
dependencies {
87-
implementation("androidx.appcompat:appcompat:1.6.1")
98+
implementation("androidx.appcompat:appcompat:1.7.1")
8899
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
89100
}

source/code/example/android/simple/simple.bff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
.Namespace = 'net.example.simple'
2020
.ApplicationID = 'net.example.myapp'
2121

22-
.TargetSDK = '34'
22+
.TargetSDK = '36'
2323
// .MinSDK = '28' This comes from the Pipeline AndroidAPILevel value
2424

2525
.VersionCode = 142
2626
.VersionName = '1.4.2'
2727

2828
.GradlePlugins = {
29-
'id("com.android.application") version "8.2.0"'
29+
'id("com.android.application") version "8.10.0"'
3030
'id("org.jetbrains.kotlin.android") version "1.8.20"'
3131
}
3232
]

source/code/framework/framework_base/private/framework_main.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ auto ice_setup(
390390

391391
if constexpr (ice::build::is_android || ice::build::is_windows)
392392
{
393-
ice::URI constexpr packs[]{ "urn://data.hsc"_uri, "urn://shaders.hsc"_uri };
393+
ice::URI constexpr packs[]{ "urn:data.hsc"_uri, "urn:shaders.hsc"_uri };
394394
for (ice::URI const& packuri : packs)
395395
{
396396
auto shaders_pak = state.resources->find_resource(packuri);

source/code/modules/imgui_module/private/imgui_system.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <ice/assert.hxx>
88
#include <ice/devui_imgui.hxx>
99
#include <ice/string/static_string.hxx>
10+
#include <ice/string/heap_string.hxx>
1011

1112
#if ISP_WINDOWS
1213
#include <imguizmo/ImGuizmo.h>

source/code/platforms/platform_android/private/android_threads.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace ice::platform::android
1717
, _scheduler_gfx{ queue_gfx }
1818
, _scheduler_tasks{ queue_tasks }
1919
, _threads{ }
20+
, _aio_port{ ice::native_aio::aio_open(alloc, ice::native_aio::AIOPortInfo{ .worker_limit = 1, .debug_name = "ice.aio-port" }) }
2021
{
2122
ice::ucount const hw_concurrency = get_nprocs();
2223
ICE_LOG(LogSeverity::Info, LogTag::System, "Logical Processors: {}", hw_concurrency);
@@ -45,4 +46,9 @@ namespace ice::platform::android
4546
);
4647
}
4748

49+
AndroidThreads::~AndroidThreads() noexcept
50+
{
51+
ice::native_aio::aio_close(_aio_port);
52+
}
53+
4854
} // namespace ice::platform::android

source/code/platforms/platform_android/private/android_threads.hxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace ice::platform::android
1717
ice::Allocator& alloc,
1818
ice::Span<ice::Shard const> params
1919
) noexcept;
20+
~AndroidThreads() noexcept;
2021

2122
auto main() noexcept -> ice::TaskScheduler& override { return _scheduler_main; }
2223
auto graphics() noexcept -> ice::TaskScheduler& override { return _scheduler_gfx; }
@@ -25,6 +26,8 @@ namespace ice::platform::android
2526
auto threadpool_size() const noexcept -> ice::u32 override { return _threads->managed_thread_count(); }
2627
auto threadpool_object() noexcept -> ice::TaskThreadPool* override { return _threads.get(); }
2728

29+
auto aio_port() const noexcept -> ice::native_aio::AIOPort override { return _aio_port; }
30+
2831
ice::TaskQueue queue_main;
2932
ice::TaskQueue queue_gfx;
3033
ice::TaskQueue queue_tasks;
@@ -34,6 +37,7 @@ namespace ice::platform::android
3437
ice::TaskScheduler _scheduler_gfx;
3538
ice::TaskScheduler _scheduler_tasks;
3639
ice::UniquePtr<ice::TaskThreadPool> _threads;
40+
ice::native_aio::AIOPort _aio_port;
3741
};
3842

3943
} // namespace ice::platform::android

0 commit comments

Comments
 (0)