Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
* [Android] Move initialization of PlatformBridge to JNI_Load(#2715)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpop1994 authored and YorkShen committed Jul 16, 2019
1 parent c371398 commit 1e40e9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 5 additions & 1 deletion weex_core/Source/android/utils/jni_load.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/

#include <jni.h>
#include "core/bridge/platform_bridge.h"
#include "android/bridge/platform/android_bridge.h"
#include "core/manager/weex_core_manager.h"
#include "android/utils/so_utils.h"
#include "android/wrap/content_box_measurement_impl_android.h"
#include "android/wrap/hash_set.h"
Expand Down Expand Up @@ -51,7 +54,8 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
WeexCore::SoUtils::Init(env);
WeexCore::WMLBridge::RegisterJNIUtils(env);
}

PlatformBridge* bridge = new AndroidBridgeInSimple;
WeexCoreManager::Instance()->set_platform_bridge(bridge);
return result ? JNI_VERSION_1_4 : JNI_FALSE;
}

Expand Down
4 changes: 1 addition & 3 deletions weex_core/Source/android/wrap/wx_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,7 @@ static jint InitFramework(JNIEnv* env, jobject object, jstring script,
->platform_side()
->ReportNativeInitStatus(status_code, error_msg);
});
// Init platform bridge
PlatformBridge* bridge = new AndroidBridgeInSimple;
WeexCoreManager::Instance()->set_platform_bridge(bridge);
PlatformBridge* bridge = WeexCoreManager::Instance()->getPlatformBridge();
// Init params
std::vector<INIT_FRAMEWORK_PARAMS*> params_vector = initFromParam(
env, params, [](const char* status_code, const char* error_msg) {
Expand Down

0 comments on commit 1e40e9c

Please sign in to comment.