gpt4 book ai didi

android - 未找到 int org.libsdl.app.SDLActivity.nativeSetupJNI() 的实现

转载 作者:太空宇宙 更新时间:2023-11-04 04:12:09 24 4
gpt4 key购买 nike

首先要确认我浏览了所有与此类似的主题,但没有发现任何可以解决我的问题的东西。当我想在我的手机上运行应用程序时,它会抛出 UnsatisfiedLinkError 和 No implementation found for int org.libsdl.app.SDLActivity.nativeSetupJNI()。

04-28 16:56:13.081 17793 17793 E art     : No implementation found for int org.etlegacy.app.SDLActivity.nativeSetupJNI() (tried Java_org_etlegacy_app_SDLActivity_nativeSetupJNI and Java_org_etlegacy_app_SDLActivity_nativeSetupJNI__)
04-28 16:56:13.082 17793 17793 D AndroidRuntime: Shutting down VM
04-28 16:56:13.082 17793 17793 E AndroidRuntime: FATAL EXCEPTION: main
04-28 16:56:13.082 17793 17793 E AndroidRuntime: Process: org.etlegacy.app, PID: 17793
04-28 16:56:13.082 17793 17793 E AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for int org.etlegacy.app.SDLActivity.nativeSetupJNI() (tried Java_org_etlegacy_app_SDLActivity_nativeSetupJNI and Java_org_etlegacy_app_SDLActivity_nativeSetupJNI__)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at org.etlegacy.app.SDLActivity.nativeSetupJNI(Native Method)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at org.etlegacy.app.SDL.setupJNI(SDL.java:15)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at org.etlegacy.app.SDLActivity.onCreate(SDLActivity.java:234)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6857)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2676)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2784)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at android.app.ActivityThread.-wrap12(ActivityThread.java)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1523)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at android.os.Looper.loop(Looper.java:163)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6238)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
04-28 16:56:13.082 17793 17793 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
04-28 16:56:13.091 3424 3645 D PowerKeeper.Event: notifyAMCrash packageName: 0, pid:17793

一直在尝试添加 JNIEXPORT 和 JNICALL,但没有成功。我将提供来自 3 个不同文件的一些代码。

系统.android.c

#include "jni.h"
/*******************************************************************************
Functions called by JNI
*******************************************************************************/

/* Start up the ET Legacy app */
JNIEXPORT void JNICALL Java_org_etlegacy_app_SDLActivity_nativeInit(JNIEnv *env, jobject obj)
{
Android_JNI_SetupThread();

SDL_SetMainReady();

/* Run the application code! */
char *argv[2];
argv[0] = SDL_strdup("ET Legacy");
// send r_fullscreen 0 with argv[1] because on fullscreen can cause some issues see: https://github.com/rafal1137/android-project/commit/d960cc244b17d8cc0d084f9c8dad9c1af4b2ba72#diff-b9bd293cfb066fe80c10d3fcdd0fd6cbL439
argv[1] = 0;
SDL_main(1, argv);

}

系统主程序

/**
* @brief SDL_main
* @param[in] argc
* @param[in] argv
* @return
*/
int main(int argc, char **argv)
{
char commandLine[MAX_STRING_CHARS] = { 0 };

Sys_PlatformInit();

// Set the initial time base
Sys_Milliseconds();

#ifdef __APPLE__
// This is passed if we are launched by double-clicking
if (argc >= 2 && Q_strncmp(argv[1], "-psn", 4) == 0)
{
argc = 1;
}
#endif

Sys_ParseArgs(argc, argv);

#if defined(__APPLE__) && !defined(DEDICATED)
// argv[0] would be /Users/seth/etlegacy/etl.app/Contents/MacOS
// But on OS X we want to pretend the binary path is the .app's parent
// So that way the base folder is right next to the .app allowing
{
char parentdir[1024];
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
if (!url)
{
Sys_Dialog(DT_ERROR, "A CFURL for the app bundle could not be found.", "Can't set Sys_SetBinaryPath");
Sys_Exit(EXIT_FAILURE);
}

CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
if (!url2 || !CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, 1024))
{
Sys_Dialog(DT_ERROR, "CFURLGetFileSystemRepresentation returned an error when finding the app bundle's parent directory.", "Can't set Sys_SetBinaryPath");
Sys_Exit(EXIT_FAILURE);
}

Sys_SetBinaryPath(parentdir);

CFRelease(url);
CFRelease(url2);
}
#else
Sys_SetBinaryPath(Sys_Dirname(argv[0]));
#endif

Sys_SetDefaultInstallPath(DEFAULT_BASEDIR); // Sys_BinaryPath() by default

// Concatenate the command line for passing to Com_Init
Sys_BuildCommandLine(argc, argv, commandLine, sizeof(commandLine));

Com_Init(commandLine);
NET_Init();

Sys_SetUpConsoleAndSignals();

#ifdef _WIN32

#ifndef DEDICATED
if (com_viewlog->integer)
{
Sys_ShowConsoleWindow(1, qfalse);
}
#endif

Sys_Splash(qfalse);

{
char cwd[MAX_OSPATH];
_getcwd(cwd, sizeof(cwd));
Com_Printf("Working directory: %s\n", cwd);
}

// hide the early console since we've reached the point where we
// have a working graphics subsystems
#ifndef LEGACY_DEBUG
if (!com_dedicated->integer && !com_viewlog->integer)
{
Sys_ShowConsoleWindow(0, qfalse);
}
#endif

#endif

Sys_GameLoop();

return EXIT_SUCCESS;
}

SDLActivity.java

protected String[] getLibraries() {
return new String[] {
"SDL2",
"hidapi",
"etl"
};
}

我应该删除 SDL_main(1, argv);从 sys_android.c 文件,以便它可以从 sys_main.c 中选择正确的?

最佳答案

问题似乎是函数名称的拼写错误,正确的是 Java_org_etlegacy_app_SDLActivity_nativeSetupJNI()

关于android - 未找到 int org.libsdl.app.SDLActivity.nativeSetupJNI() 的实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55892758/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com