From 3b1d39dd13aa5ca60dd7ff3e54dca40d8b715512 Mon Sep 17 00:00:00 2001 From: Nocxr <72276215+Nocxr@users.noreply.github.com> Date: Tue, 16 Sep 2025 02:00:26 -0700 Subject: [PATCH 1/6] SignatureHelper breaking on TArray fix 0>SignatureHelper.h(78,52): Error : returning address of local temporary object [-Werror,-Wreturn-stack-address] 0> 78 | GetTypeSignature() { return const_cast(StringCast(FString::Printf(TEXT("[%s"), *FString(GetTypeSignature()))).Get()); } 0> AI Assistant Diagnosis The error returning address of local temporary object [-Werror,-Wreturn-stack-address] is triggered by the TArray specialization of SignatureHelper::GetTypeSignature. It constructs an FString and then uses StringCast(...).Get() to obtain a pointer to a transient buffer owned by a temporary StringCast. That buffer becomes invalid as soon as the expression ends, so returning it yields a dangling pointer. This hits when you call CallJavaStaticMethod(...), since it needs the JNI signature for an int32 array, which should be "[I". The faulty specialization tries to build and return that via a temporary cast. Fix Make the TArray specialization return an owning FString instead of a pointer, and build the signature directly as a TCHAR string. This avoids returning a pointer to a temporary. All concatenations are done into an FString already, so appending a FString works seamlessly. Why this resolves the error - No pointer to data owned by a temporary is returned anymore. - For TArray, this now correctly produces the JNI type signature "[I" as an FString, which is safely appended in GetTypeSignatures and GetMethodSignature. Notes - Other GetTypeSignature overloads return string literals (which have static storage duration), so they are safe. - At the final call site, you already convert the complete method signature FString to ANSICHAR just-in-time, which is safe within that expression. --- Source/AndroidNative/Public/Helpers/SignatureHelper.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/AndroidNative/Public/Helpers/SignatureHelper.h b/Source/AndroidNative/Public/Helpers/SignatureHelper.h index 96d7772..da234ba 100644 --- a/Source/AndroidNative/Public/Helpers/SignatureHelper.h +++ b/Source/AndroidNative/Public/Helpers/SignatureHelper.h @@ -1,4 +1,4 @@ -// Georgy Treshchev 2024. +// Georgy Treshchev 2024. #pragma once @@ -74,8 +74,12 @@ namespace SignatureHelper /** Get the signature for the type contained in TArray */ template - static FORCEINLINE typename TEnableIf::Value, const ANSICHAR*>::Type - GetTypeSignature() { return const_cast(StringCast(*FString::Printf(TEXT("[%s"), *FString(GetTypeSignature()))).Get()); } + static FORCEINLINE typename TEnableIf::Value, FString>::Type + GetTypeSignature() + { + // Build and return a stable FString (e.g., "[I" for TArray) + return FString::Printf(TEXT("[%s"), *FString(GetTypeSignature())); + } /** * In case no arguments and type are specified From 3f4051ea541d716024bfcdfd75037504d9ae3725 Mon Sep 17 00:00:00 2001 From: Nocxr <72276215+Nocxr@users.noreply.github.com> Date: Tue, 16 Sep 2025 02:03:16 -0700 Subject: [PATCH 2/6] Update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fb48575..c02ccca 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ **Important Notice:** This plugin is no longer maintained. It may contain bugs and lack some features. -For support or questions, feel free to join the [Discord chat](https://georgy.dev/discord). \ No newline at end of file +For support or questions, feel free to join the [Discord chat](https://georgy.dev/discord). + + +------------------------------------------------------------ + +My attempt to keep this plugin running even though support has ended for it From ceb52786cbc65d6c911de9093c58e0a5611cd478 Mon Sep 17 00:00:00 2001 From: Nocxr <72276215+Nocxr@users.noreply.github.com> Date: Tue, 16 Sep 2025 02:05:31 -0700 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c02ccca..813df0f 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,4 @@ For support or questions, feel free to join the [Discord chat](https://georgy.de ------------------------------------------------------------ -My attempt to keep this plugin running even though support has ended for it +My attempt to keep this plugin running even though support has ended for it. I may add some simple examples to help others try and get up to speed. Confirmed working on 5.5.4 as of 9/16/25. From eaaf2759fc7550d7cb6f6dc86e3ba9afd31129da Mon Sep 17 00:00:00 2001 From: Nocxr <72276215+Nocxr@users.noreply.github.com> Date: Tue, 16 Sep 2025 02:06:13 -0700 Subject: [PATCH 4/6] Update README.md --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 813df0f..38a8526 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,3 @@ -**Important Notice:** -This plugin is no longer maintained. It may contain bugs and lack some features. - -For support or questions, feel free to join the [Discord chat](https://georgy.dev/discord). - - ------------------------------------------------------------ - My attempt to keep this plugin running even though support has ended for it. I may add some simple examples to help others try and get up to speed. Confirmed working on 5.5.4 as of 9/16/25. +------------------------------------------------------------ From 83225923bd509334cdc58adbcd3d13d1fbc15ac9 Mon Sep 17 00:00:00 2001 From: Nocxr <72276215+Nocxr@users.noreply.github.com> Date: Tue, 16 Sep 2025 02:28:15 -0700 Subject: [PATCH 5/6] Update README.md --- README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 38a8526..95c030c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,51 @@ ------------------------------------------------------------- -My attempt to keep this plugin running even though support has ended for it. I may add some simple examples to help others try and get up to speed. Confirmed working on 5.5.4 as of 9/16/25. ------------------------------------------------------------- +# AndroidNative Plugin Fork + +## Overview + +This is my attempt to keep this plugin running even though official support has ended. Any changes made on this fork are not part of the official plugin at all. The goal is to keep it functional for users who still rely on it. + +## Engine Compatibility + +| Engine Version | Status | Notes | +|---------------|--------|-------| +| 5.5.4 | ✅ Yes | Confirmed working | +| 5.6.1 | ❓ Unknown | Not yet tested | +| 5.7 Preview 1 | ❓ Unknown | Not yet tested | + +## Requirements + +- Project must be a **C++ project** (Blueprint-only projects are not supported) +- Development environment for Android builds + +## Documentation + +**Official Documentation**: [https://docs.georgy.dev/android-native/overview](https://docs.georgy.dev/android-native/overview) + +*Note: This documentation is for the original plugin. Some information may not apply to this community fork.* + +## Getting Started + + + +### Installation + +1. Navigate to your project's `Plugins` folder +2. Clone this repository: + ``` + git clone https://github.com/Nocxr/AndroidNative.git + ``` +3. Right-click your `.uproject` file and select "Generate Visual Studio project files" +5. Navigate to `Plugins/AndroidNative/Source/AndroidNative/Private/Java/` and add your `.java` files + +### Basic Usage + +**TODO:** +- [ ] Show no arg call +- [ ] Show arg call +- [ ] Show Java to C++ callback +- [ ] Show activity usage +- [ ] Show custom arg usage + +## Disclaimer + +This fork is maintained on a best-effort basis. There are no guarantees of compatibility, stability, or continued maintenance. Use at your own risk. From 2989d9a54ce0b782b77b5fac37bc12598458b70e Mon Sep 17 00:00:00 2001 From: Nocxr <72276215+Nocxr@users.noreply.github.com> Date: Tue, 16 Sep 2025 02:52:39 -0700 Subject: [PATCH 6/6] updating 5.6.1 status in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 95c030c..1af6002 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This is my attempt to keep this plugin running even though official support has | Engine Version | Status | Notes | |---------------|--------|-------| | 5.5.4 | ✅ Yes | Confirmed working | -| 5.6.1 | ❓ Unknown | Not yet tested | +| 5.6.1 | 🟠 Compiles | Not yet tested | | 5.7 Preview 1 | ❓ Unknown | Not yet tested | ## Requirements