Error[8]: Undefined offset: 3, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述我需要做什么:>将SDL2源编译为x86和ARM64体系结构的.so文件>在Xamarin.Android中引用此文件>在我的C#代码中调用SDL2方法.到目前为止我学到的东西:>SDL2需要JavaActivity或JNI绑定来调用本机代码.>如果不以某种方式将SDL2库和JNI集成到Xamarin.Android项目中,我无法继续.>我无

我需要做什么:

>将SDL2源编译为x86和ARM64体系结构的.so文件
>在Xamarin.Android中引用此文件
>在我的C#代码中调用SDL2方法.

到目前为止我学到的东西:

> SDL2需要Java Activity或JNI绑定来调用本机代码.
>如果不以某种方式将SDL2库和JNI集成到Xamarin.AndroID项目中,我无法继续.
>我无法解决这个问题,我的大脑在这个过程中已经炒了.

我试过的事情:

>过时的GitHub项目:

https://github.com/0x0ade/SDL2Droid-CS

https://github.com/fallahn/sdl2vs

>这篇博文可以让我创建C代码但不使用Xamarin

https://trederia.blogspot.com/2017/03/building-sdl2-for-android-with-visual.html

>通过AndroID Studio运行SDL2,虽然有效但无法帮助我,因为我需要调用我的C#代码.

我没有广泛的Xamarin知识,所以我不知道该怎么做,我现在真的可以用另一双眼睛了. SDL2DroID-CS GitHub项目理论上应该可行,但我找不到一种方法来编译该项目中用于C#中包含的x86仿真器的SDL2.

我尝试使用armeabiv7 libsdl2.so编译我的代码,然后直接在我的手机上运行它.不幸的是,Visual Studio无法对此进行调试,因此我很难实现我的代码.

接下来我尝试通过AndroID Studio调试以前编译的应用程序(使用SDL2DroID-CS),它给了我这个错误:

06-19 00:39:55.362 13143-13143/? I/zygote64: Late-enabling -Xcheck:jni06-19 00:39:55.474 13143-13143/SDL2DroID_CS.SDL2DroID_CS W/ActivityThread: Application SDL2DroID_CS.SDL2DroID_CS can be deBUGged on port 8100...06-19 00:39:55.514 13143-13143/? W/monodroID: Creating public update directory: `/data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__`    Using overrIDe path: /data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__    Using overrIDe path: /storage/emulated/0/AndroID/data/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__    Trying to load sgen from: /data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__/libmonosgen-2.0.so    Trying to load sgen from: /storage/emulated/0/AndroID/data/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__/libmonosgen-2.0.so    Trying to load sgen from: /storage/emulated/0/../legacy/AndroID/data/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__/libmonosgen-2.0.so    Trying to load sgen from: /data/app/SDL2DroID_CS.SDL2DroID_CS-wmpu9Ce48QdJhvYc6bPRiA==/lib/arm64/libmonosgen-2.0.so    Trying to load sgen from: /data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__/links/libmonosgen-2.0.so06-19 00:39:55.515 13143-13143/? W/monodroID: Trying to load sgen from: /system/lib/libmonosgen-2.0.so06-19 00:39:55.515 13143-13143/? A/monodroID: cannot find libmonosgen-2.0.so in overrIDe_dir: /data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__, app_libdir: /data/app/SDL2DroID_CS.SDL2DroID_CS-wmpu9Ce48QdJhvYc6bPRiA==/lib/arm64 nor in prevIoUsly printed locations.    Do you have a shared runtime build of your app with AndroIDManifest.xml androID:minSdkVersion < 10 while running on a 64-bit AndroID 5.0 target? This combination is not supported.    Please either set androID:minSdkVersion >= 10 or use a build without the shared runtime (like default Release configuration).

Min SDK是19,所以它给出的错误很奇怪.

我假设SDL2没有正确实现,导致所有这些问题. GitHub代码有一些漏洞,上传它的人还没有激活.

资源:

> SDL2网站:https://www.libsdl.org/
> SDL2资料来源:https://www.libsdl.org/release/SDL2-2.0.8.zip
> SDL2DroID GitHub项目:https://github.com/0x0ade/SDL2Droid-CS
>博客中的GitHub项目:https://github.com/fallahn/sdl2vs
> Blog that explains building SDL2 in Visual Studio

解决方法:

TL; DR:工作文件在这里:https://github.com/MananAdhvaryu/Android-SDL2-Libraries

所以我想出了崩溃,这是因为Visual Studio实现了调试的共享运行时.通过在项目设置中禁用Shared Runtime来解决此问题.

项目设置 – > AndroID选项 – >解开“使用共享运行时”

1.至于为什么GitHub代码不起作用:

这是由于“绑定”项目中的.jar文件损坏.我能够通过自己从SDL2源代码编译.jar文件来修复它.您需要编译的.java文件是here,或者您可以从源代码中获取它.

一旦你有工作.jar只需从Jars文件夹中删除现有的.jar并将其替换为新的.jar.

如果无法生成.jar文件,可以使用上面链接的GitHub项目中的文件

2.要创建.so文件:

之后,需要编译处理器体系结构所需的.so文件.它是使用AndroID NDK和make脚本完成的.来自SDL2DroID GitHub的make脚本工作正常,所以我只需更改一些参数就可以将androID minSdkVersion增加到19并获得所有架构的.so文件(x86,x86_64,ARM,ARM64)

#!/bin/bashNATIVEDIR=$(dirname "[+++]")ndk-build -j 4 NDK_PROJECT_PATH="$NATIVEDIR/../SDL2DroID-CS" NDK_APPliCATION_MK="$NATIVEDIR/Application.mk"

这是生成.so文件的bash代码.如果您使用命令提示符,只需将“$NATIVEDIR”更改为项目的绝对路径.

如果您无法生成这些本机库,那么您可以使用上面链接的GitHub存储库中的那个.

他们需要最低限度的sdk androID-19,并且可用于所有支持的架构.

要使用它们,只需将libs文件夹放在Xamarin.AndroID项目目录中.

总结

以上是内存溢出为你收集整理的如何将SDL2库实现到Xamarin.Android中?全部内容,希望文章能够帮你解决如何将SDL2库实现到Xamarin.Android中?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
如何将SDL2库实现到Xamarin.Android中?_app_内存溢出

如何将SDL2库实现到Xamarin.Android中?

如何将SDL2库实现到Xamarin.Android中?,第1张

概述我需要做什么:>将SDL2源编译为x86和ARM64体系结构的.so文件>在Xamarin.Android中引用此文件>在我的C#代码中调用SDL2方法.到目前为止我学到的东西:>SDL2需要JavaActivity或JNI绑定来调用本机代码.>如果不以某种方式将SDL2库和JNI集成到Xamarin.Android项目中,我无法继续.>我无

我需要做什么:

>将SDL2源编译为x86和ARM64体系结构的.so文件
>在Xamarin.Android中引用此文件
>在我的C#代码中调用SDL2方法.

到目前为止我学到的东西:

> SDL2需要Java Activity或JNI绑定来调用本机代码.
>如果不以某种方式将SDL2库和JNI集成到Xamarin.AndroID项目中,我无法继续.
>我无法解决这个问题,我的大脑在这个过程中已经炒了.

我试过的事情:

>过时的GitHub项目:

https://github.com/0x0ade/SDL2Droid-CS

https://github.com/fallahn/sdl2vs

>这篇博文可以让我创建C代码但不使用Xamarin

https://trederia.blogspot.com/2017/03/building-sdl2-for-android-with-visual.html

>通过AndroID Studio运行SDL2,虽然有效但无法帮助我,因为我需要调用我的C#代码.

我没有广泛的Xamarin知识,所以我不知道该怎么做,我现在真的可以用另一双眼睛了. SDL2DroID-CS GitHub项目理论上应该可行,但我找不到一种方法来编译该项目中用于C#中包含的x86仿真器的SDL2.

我尝试使用armeabiv7 libsdl2.so编译我的代码,然后直接在我的手机上运行它.不幸的是,Visual Studio无法对此进行调试,因此我很难实现我的代码.

接下来我尝试通过AndroID Studio调试以前编译的应用程序(使用SDL2DroID-CS),它给了我这个错误:

06-19 00:39:55.362 13143-13143/? I/zygote64: Late-enabling -Xcheck:jni06-19 00:39:55.474 13143-13143/SDL2DroID_CS.SDL2DroID_CS W/ActivityThread: Application SDL2DroID_CS.SDL2DroID_CS can be deBUGged on port 8100...06-19 00:39:55.514 13143-13143/? W/monodroID: Creating public update directory: `/data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__`    Using overrIDe path: /data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__    Using overrIDe path: /storage/emulated/0/AndroID/data/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__    Trying to load sgen from: /data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__/libmonosgen-2.0.so    Trying to load sgen from: /storage/emulated/0/AndroID/data/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__/libmonosgen-2.0.so    Trying to load sgen from: /storage/emulated/0/../legacy/AndroID/data/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__/libmonosgen-2.0.so    Trying to load sgen from: /data/app/SDL2DroID_CS.SDL2DroID_CS-wmpu9Ce48QdJhvYc6bPRiA==/lib/arm64/libmonosgen-2.0.so    Trying to load sgen from: /data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__/links/libmonosgen-2.0.so06-19 00:39:55.515 13143-13143/? W/monodroID: Trying to load sgen from: /system/lib/libmonosgen-2.0.so06-19 00:39:55.515 13143-13143/? A/monodroID: cannot find libmonosgen-2.0.so in overrIDe_dir: /data/user/0/SDL2DroID_CS.SDL2DroID_CS/files/.__overrIDe__, app_libdir: /data/app/SDL2DroID_CS.SDL2DroID_CS-wmpu9Ce48QdJhvYc6bPRiA==/lib/arm64 nor in prevIoUsly printed locations.    Do you have a shared runtime build of your app with AndroIDManifest.xml androID:minSdkVersion < 10 while running on a 64-bit AndroID 5.0 target? This combination is not supported.    Please either set androID:minSdkVersion >= 10 or use a build without the shared runtime (like default Release configuration).

Min SDK是19,所以它给出的错误很奇怪.

我假设SDL2没有正确实现,导致所有这些问题. GitHub代码有一些漏洞,上传它的人还没有激活.

资源:

> SDL2网站:https://www.libsdl.org/
> SDL2资料来源:https://www.libsdl.org/release/SDL2-2.0.8.zip
> SDL2DroID GitHub项目:https://github.com/0x0ade/SDL2Droid-CS
>博客中的GitHub项目:https://github.com/fallahn/sdl2vs
> Blog that explains building SDL2 in Visual Studio

解决方法:

TL; DR:工作文件在这里:https://github.com/MananAdhvaryu/Android-SDL2-Libraries

所以我想出了崩溃,这是因为Visual Studio实现了调试的共享运行时.通过在项目设置中禁用Shared Runtime来解决此问题.

项目设置 – > AndroID选项 – >解开“使用共享运行时”

1.至于为什么GitHub代码不起作用:

这是由于“绑定”项目中的.jar文件损坏.我能够通过自己从SDL2源代码编译.jar文件来修复它.您需要编译的.java文件是here,或者您可以从源代码中获取它.

一旦你有工作.jar只需从Jars文件夹中删除现有的.jar并将其替换为新的.jar.

如果无法生成.jar文件,可以使用上面链接的GitHub项目中的文件

2.要创建.so文件:

之后,需要编译处理器体系结构所需的.so文件.它是使用AndroID NDK和make脚本完成的.来自SDL2DroID GitHub的make脚本工作正常,所以我只需更改一些参数就可以将androID minSdkVersion增加到19并获得所有架构的.so文件(x86,x86_64,ARM,ARM64)

#!/bin/bashNATIVEDIR=$(dirname "")ndk-build -j 4 NDK_PROJECT_PATH="$NATIVEDIR/../SDL2DroID-CS" NDK_APPliCATION_MK="$NATIVEDIR/Application.mk"

这是生成.so文件的bash代码.如果您使用命令提示符,只需将“$NATIVEDIR”更改为项目的绝对路径.

如果您无法生成这些本机库,那么您可以使用上面链接的GitHub存储库中的那个.

他们需要最低限度的sdk androID-19,并且可用于所有支持的架构.

要使用它们,只需将libs文件夹放在Xamarin.AndroID项目目录中.

总结

以上是内存溢出为你收集整理的如何将SDL2库实现到Xamarin.Android中?全部内容,希望文章能够帮你解决如何将SDL2库实现到Xamarin.Android中?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1104734.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存