gpt4 book ai didi

android - 在 Android Studio 中使用 libpd

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:24:21 24 4
gpt4 key购买 nike

所以我从 https://github.com/libpd/pd-for-android 得到了 git 仓库并在 Android Studio 中为我的“AmazingSynthesizer”创建了一个新的空白项目。

我使用“导入模块”向导导入 PdCore 和 AndroidMidi。然后,右键单击“应用程序”以查看我的“模块设置”。在依赖项下,我将 PdCore 添加为模块依赖项。此外,我将 AndroidMidi 添加为“PdCore”的模块依赖项。

到目前为止,这对我来说似乎是正确的。我的应用程序的 build.gradle 包含库,我可以在我的 MainActivity 中导入 PdDispatcher。问题是,它似乎仍然缺少本地库(我认为!)。

来自官方 libpd 书籍的非常基本的示例代码(Peter Brinkmann 制作的音乐应用程序)

PdAudio.initAudio(sampleRate, 0, 2, 8, true);

惨败

java.lang.UnsatisfiedLinkError: Couldn't load pd from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.app.amazingsynthesizer-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.app.amazingsynthesizer-1, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at org.puredata.core.PdBase.<clinit>(PdBase.java:55)
at org.puredata.android.io.PdAudio.startAudio(PdAudio.java:86)
at com.app.amazingsynthesizer.MainActivity.onResume(MainActivity.java:62)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1192)
at android.app.Activity.performResume(Activity.java:5310)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)

最佳答案

[2016 年 1 月 17 日更新]

现在pd-for-android library artifact 已经发布到 jCenter,最简单的解决方案变得更加简单:没有克隆,没有导入;只需编辑项目的 build.gradle 文件并添加对 org.puredata.android:pd-core:1.0.0 的编译依赖。

请参阅 pd-for-android 的更新自述文件以获得帮助。

原始接受的答案:

The simplest way to get up and running is to copy the prebuilt .so files to:

AmazingSynthesizer/src/main/jniLibs

You'll need libpd.so and libpdnativeopensl.so for the architectures that you are targeting, for example:

AmazingSynthesizer/src/main/jniLibs/armeabi/libpd.so AmazingSynthesizer/src/main/jniLibs/armeabi/libpdnativeopensl.so

关于android - 在 Android Studio 中使用 libpd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25491743/

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