Search Issue Tracker
Fixed in 2018.3.X
Fixed in 2017.4.X, 2019.1.X
Votes
28
Found in
2018.3.0b4
2018.3.2f1
Issue ID
1126040
Regression
Yes
[Android] App crashes when invoking Java Proxy while the app is in the background
Repro steps:
1. Open QA attached project "repro_1126040""
2. Open scene "Sample Scene"
3. Build and Run on Android
4. Press the left button
5. Press the right button "Quit"
Actual: After some time the app crashes
Reproducible with: 2018.3.0b4, 2018.3.8f1, 2019.1.0b7, 2019.2.0a8
Not reproducible with: 2017.4.23f1, 2018.3.0b3
Tested and reproduced on these devices:
VLNQA00027, Xiaomi MI MAX (MI MAX), Android 7.0, CPU: Snapdragon 617 MSM8952, GPU: Adreno (TM) 510
VLNQA00150, Samsung Galaxy S9 (SM-G960U), Android 8.0.0, CPU: Snapdragon 845 SDM845, GPU: Adreno (TM) 630
VLNQA00078, Motorola Nexus 6 (Nexus 6), Android 7.1.1, CPU: Snapdragon 805 APQ8084AB, GPU: Adreno (TM) 420
Didn't reproduce on this device:
VLNQA00034, Lge Nexus 4 (Nexus 4), Android 5.1.1, CPU: Snapdragon S4 Pro APQ8064, GPU: Adreno (TM) 320
Fixed in: 2019.2.0a11
Backported to: 2017.4.26f1, 2018.3.13f1, 2019.1.0b11
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- SerializedPropertyChangeEvent is invoked when initially binding PropertyFields in custom Editor
- UI Panel is not visible when HDR and STP filter are enabled
- Crash on GfxDeviceD3D11Base::DrawBuffersIndirect when opening a specific project
- OnTriggerExit2D is called in Play mode when undoing component adding
- Builds fail with "Execution failed for task ':launcher:checkReleaseDuplicateClasses'" error when the newer version of the In-App Purchasing package is installed on a specific project
jamieghosal
Jan 06, 2022 09:51
Steps:
create dynamic proxy instance
call native method and pass the proxy instance as a parameter
use jni to invoke some method on proxy instance
App code:
val target = object : ProxyTest {
override fun testVoid() {
Log.e(TAG, "testVoid: ")
}
override fun testString(): String {
Log.e(TAG, "testString: ")
return "hello"
}
}
val proxy = Proxy.newProxyInstance(
classLoader, arrayOf(ProxyTest::class.java)
) { proxy, method, args ->
// if open code below, it will crash on all device
// if not open, it will crash only on android 6.0, mostly on Vivo Y67
//val myargs = args ?: emptyArray()
//method.invoke(target, *myargs)
} as ProxyTest
invokeProxyMethod(proxy)
interface ProxyTest {
fun testVoid()
fun testString(): String
}
Native code:
extern "C"
JNIEXPORT void JNICALL
Java_com_aprz_mytestdemo_jni_JNIInvokeProxyMethodActivity_invokeProxyMethod(JNIEnv *env,
__unused jobject thiz,
jobject proxy) {
jclass proxy_class = env->GetObjectClass(proxy);
// jmethodID test_void_method_id = env->GetMethodID(proxy_class, "testString", "()Ljava/lang/String;");
jmethodID test_void_method_id = env->GetMethodID(proxy_class, "testVoid", "()V");
LOGD("jmethodId = %d", test_void_method_id == nullptr);
jvalue *args = {};
jobject obj = env->NewLocalRef(proxy);
env->CallVoidMethodA(obj, test_void_method_id, args);
Nomibuilder
Apr 10, 2019 05:25
Couldn't find a fixture in Unity 2018.3.12
When can we expect the newer version pleasE?
pertz
Apr 08, 2019 18:19
2018.3.12f1 was just released and I cant find this issue on the release notes, so I guess the fix didnt make on this version
pertz
Apr 04, 2019 23:09
Related thread: https://forum.unity.com/threads/crashes-on-android-after-migrating-to-unity-2018-3-when-use-androidjavaproxy-class.627637/page-3#post-4393006
Fixed, expected to be released on 2018.3.12f1
toberr
Mar 14, 2019 14:04
"Not reproducible with: 2017.4.23f1, 2018.3.0b3"
This is not entirely true. With 2018.3.0b3 we have in 5 times less crashes, but still have.
$Proxy9.onAdLoaded
LeMobile Le X829 and Xiaomi Mi A2
$Proxy8.onAdFailedToLoad
samsung SM-G361H
$Proxy10.OnProductsRetrieved
Sony G3313
$Proxy9.onAdFailedToLoad
samsung SM-J200GU
$Proxy9.onAdLoaded
OPPO CPH1803