mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add @DoNotStrip to method called from cpp in bridgeless mode
Summary: I hit a crash when testing bridgeless mode in a release build: Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/modules/core/JavaTimerManager;.createTimer(IJZ)V" It turns out that `JavaTimerManager.createTimer()` is getting stripped from release builds because it's not referenced in Java at all. Adding `DoNotStrip` annotation to keep it around. The other methods in JavaTimerManager don't need this because they're referenced by TimingModule - this is the only method that's only used directly from C++ by bridgeless mode. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D19655519 fbshipit-source-id: 8b9862475986bb84b12d81f73f677cc2e4860c67
This commit is contained in:
committed by
Facebook Github Bot
parent
2f758c3abb
commit
d3b2ac3a84
@@ -9,6 +9,7 @@ package com.facebook.react.modules.core;
|
||||
|
||||
import android.util.SparseArray;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
@@ -293,6 +294,7 @@ public class JavaTimerManager {
|
||||
* @param delay The time in ms before the callback should be invoked.
|
||||
* @param repeat Whether the timer should be repeated (used for setInterval).
|
||||
*/
|
||||
@DoNotStrip
|
||||
public void createTimer(final int callbackID, final long delay, final boolean repeat) {
|
||||
long initialTargetTime = SystemClock.nanoTime() / 1000000 + delay;
|
||||
Timer timer = new Timer(callbackID, initialTargetTime, (int) delay, repeat);
|
||||
|
||||
Reference in New Issue
Block a user