Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot 4.3 WebRTC插件在Android上无法加载 #158

Closed
lcGoodAi opened this issue Dec 5, 2024 · 8 comments
Closed

Godot 4.3 WebRTC插件在Android上无法加载 #158

lcGoodAi opened this issue Dec 5, 2024 · 8 comments

Comments

@lcGoodAi
Copy link

lcGoodAi commented Dec 5, 2024

Godot version

4.0-4.3 stable

Plugin version

godot-extension-4.1-webrtc

System information

android10 ,api29

Issue description

USER ERROR: Error calling from signal 'connected' to callable: 'Control(client_ui.gd)::_connected': Method expected 0 arguments, but called with 2.
E at: emit_signalp (core/object/object.cpp:1080)
I Peer connected 1
E USER WARNING: No default WebRTC extension configured.
E at: create (modules/webrtc/webrtc_peer_connection.cpp:51)
E USER ERROR: Required virtual method WebRTCPeerConnectionExtension::_initialize must be overridden before calling.
E at: _gdvirtual__initialize_call (modules/webrtc/webrtc_peer_connection_extension.h:52)
E USER ERROR: Required virtual method WebRTCPeerConnectionExtension::_get_connection_state must be overridden before calling.
E at: _gdvirtual__get_connection_state_call (modules/webrtc/webrtc_peer_connection_extension.h:49)
E USER ERROR: Required virtual method WebRTCPeerConnectionExtension::_create_data_channel must be overridden before calling.
E at: _gdvirtual__create_data_channel_call (modules/webrtc/webrtc_peer_connection_extension.h:53)
E USER ERROR: Condition "peer->channels[CH_RELIABLE].is_null()" is true. Returning: FAILED
E at: add_peer (modules/webrtc/webrtc_multiplayer_peer.cpp:312)
E USER ERROR: Required virtual method WebRTCPeerConnectionExtension::_create_offer must be overridden before calling.
E at: _gdvirtual__create_offer_call (modules/webrtc/webrtc_peer_connection_extension.h:54)
I Peer connected 16872736
E USER ERROR: Condition "peer->channels[CH_RELIABLE].is_null()" is true. Returning: FAILED
E at: add_peer (modules/webrtc/webrtc_multiplayer_peer.cpp:312)
I Peer connected 2017475491
E USER ERROR: Condition "peer->channels[CH_RELIABLE].is_null()" is true. Returning: FAILED
E at: add_peer (modules/webrtc/webrtc_multiplayer_peer.cpp:312)

what ?

Steps to reproduce

var peer: WebRTCPeerConnection = WebRTCPeerConnection.new()
peer.initialize({
"iceServers": [ { "urls": ["stun:stun.l.google.com:19302"] } ]
})
peer.session_description_created.connect(self._offer_created.bind(id))
peer.ice_candidate_created.connect(self._new_ice_candidate.bind(id))
rtc_mp.add_peer(peer, id)
if id < rtc_mp.get_unique_id(): # So lobby creator never creates offers.
peer.create_offer()
return peer

Minimal reproduction project

No response

@lcGoodAi
Copy link
Author

lcGoodAi commented Dec 5, 2024

When trying to compile and publish all versions of godot 4.0 on Windows to Android, similar errors occur. However, it can run normally on Windows, but I don't know what the reason is

@lcGoodAi lcGoodAi changed the title USER WARNING: No default WebRTC extension configured. USER WARNING: No default WebRTC extension configured.Godot 4.3 WebRTC插件在Android上无法加载:动态库缺失和扩展初始化问题 Dec 11, 2024
@lcGoodAi
Copy link
Author

WebRTC插件在Android上无法加载:
在 Windows 上,WebRTC插件可以正常运行,但是在导出到 Android 平台后,插件无法加载。控制台显示以下错误:

vbnet
复制代码
USER ERROR: Can't open dynamic library: webrtc/lib/libwebrtc_native.android.template_debug.x86_64.so
Error: dlopen failed: library "libwebrtc_native.android.template_debug.x86_64.so" not found.

USER ERROR: Required virtual method WebRTCPeerConnectionExtension::_initialize must be overridden before calling.

我的开发环境:
Godot版本:4.3
操作系统:Windows(开发)/ Android(目标平台)
WebRTC插件:从GitHub下载并手动安装的WebRTC插件

@lcGoodAi lcGoodAi changed the title USER WARNING: No default WebRTC extension configured.Godot 4.3 WebRTC插件在Android上无法加载:动态库缺失和扩展初始化问题 Godot 4.3 WebRTC插件在Android上无法加载:动态库缺失和扩展初始化问题 Dec 11, 2024
@lcGoodAi lcGoodAi changed the title Godot 4.3 WebRTC插件在Android上无法加载:动态库缺失和扩展初始化问题 Godot 4.3 WebRTC插件在Android上无法加载 Dec 11, 2024
@lcGoodAi lcGoodAi changed the title Godot 4.3 WebRTC插件在Android上无法加载 <a href="https://github.com/godotengine/webrtc-native/issues/158">Godot 4.3 WebRTC插件在Android上无法加载</a> Dec 11, 2024
@lcGoodAi lcGoodAi changed the title <a href="https://github.com/godotengine/webrtc-native/issues/158">Godot 4.3 WebRTC插件在Android上无法加载</a> Godot 4.3 WebRTC插件在Android上无法加载 Dec 11, 2024
@Faless
Copy link
Collaborator

Faless commented Dec 11, 2024

What android device are you testing on?

I see:

USER ERROR: Can't open dynamic library: webrtc/lib/libwebrtc_native.android.template_debug.x86_64.so
Error: dlopen failed: library "libwebrtc_native.android.template_debug.x86_64.so" not found.

Which seems to suggest an x86_64 android device?

@lcGoodAi
Copy link
Author

The result of running on Android phones and Windows Android emulators is the same, the program cannot load the SO file correctly, but the exe packaged under Windows can run normally

@lcGoodAi
Copy link
Author

USER ERROR: Can't open dynamic library: addons/webrtc/lib/libwebrtc_native.android.template_debug.arm64.so. Error: dlopen failed: library "libwebrtc_native.android.template_debug.arm64.so" not found.
at: open_dynamic_library (platform/android/os_android.cpp:240)
USER ERROR: Can't open GDExtension dynamic library: addons/webrtc/lib/libwebrtc_native.android.template_debug.arm64.so
at: open_library (core/extension/gdextension.cpp:802)
USER ERROR: Failed loading resource: res://addons/webrtc/webrtc.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
at: _load (core/io/resource_loader.cpp:284)
USER ERROR: Error loading extension: res://addons/webrtc/webrtc.gdextension
at: load_extensions (core/extension/gdextension_manager.cpp:234)

@lcGoodAi
Copy link
Author

The file fails to load correctly both on the Android system and in the emulator. How can I resolve this issue?

@lcGoodAi
Copy link
Author

Does anyone know what the reason is? Could you please let us know?@fabio Alessandrelli

@lcGoodAi
Copy link
Author

Error OS_Android::open_dynamic_library(const String &p_path, void *&p_library_handle, GDExtensionData *p_data) {
String path = p_path;
bool so_file_exists = true;
if (!FileAccess::exists(path)) {
path = p_path.get_file();
so_file_exists = false;
}

p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
if (!p_library_handle && so_file_exists) {
	// The library (and its dependencies) may be on the sdcard and thus inaccessible.
	// Try to copy to the internal directory for access.
	const String dynamic_library_path = get_dynamic_libraries_path();

	if (p_data != nullptr && p_data->library_dependencies != nullptr && !p_data->library_dependencies->is_empty()) {
		// Copy the library dependencies
		print_verbose("Copying library dependencies..");
		for (const String &library_dependency_path : *p_data->library_dependencies) {
			String internal_library_dependency_path;
			if (!copy_dynamic_library(library_dependency_path, dynamic_library_path.path_join(library_dependency_path.get_base_dir()), &internal_library_dependency_path)) {
				ERR_PRINT(vformat("Unable to copy library dependency %s", library_dependency_path));
			} else {
				void *lib_dependency_handle = dlopen(internal_library_dependency_path.utf8().get_data(), RTLD_NOW);
				if (!lib_dependency_handle) {
					ERR_PRINT(vformat("Can't open dynamic library dependency: %s. Error: %s.", internal_library_dependency_path, dlerror()));
				}
			}
		}
	}

	String internal_path;
	print_verbose("Copying library " + p_path);
	const bool internal_so_file_exists = copy_dynamic_library(p_path, dynamic_library_path.path_join(p_path.get_base_dir()), &internal_path);

	if (internal_so_file_exists) {
		print_verbose("Opening library " + internal_path);
		p_library_handle = dlopen(internal_path.utf8().get_data(), RTLD_NOW);
		if (p_library_handle) {
			path = internal_path;
		}
	}
}

ERR_FAIL_NULL_V_MSG(p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));

if (p_data != nullptr && p_data->r_resolved_path != nullptr) {
	*p_data->r_resolved_path = path;
}

return OK;

}

USER ERROR: Can't open dynamic library: webrtc/lib/libwebrtc_native.android.template_debug.arm64.so. Error: dlopen failed: library "libwebrtc_native.android.template_debug.arm64.so" not found.
at: open_dynamic_library (platform/android/os_android.cpp:200)
USER ERROR: GDExtension dynamic library not found: webrtc/lib/libwebrtc_native.android.template_debug.arm64.so
at: open_library (core/extension/gdextension.cpp:719)
USER ERROR: Failed loading resource: res://webrtc/webrtc.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
at: _load (core/io/resource_loader.cpp:275)
USER ERROR: Error loading extension: res://webrtc/webrtc.gdextension
at: load_extensions (core/extension/gdextension_manager.cpp:234)
use miui action receive app active broadcast for: AppActiveStatRecord{packageName='com.example.testweb', installer='null', miuiActiveId='null', miuiActiveTime=-1, activeTime=1735279540036, activeType=1, userId=0, activationSource='null', reportSource='null'}
USER ERROR: Remote Debugger: Unable to connect. Status: 3.
at: connect_to_host (core/debugger/remote_debugger_peer.cpp:182)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants