Projenizde CMake yerine Android Gradle eklentisinin 4.0 sürümü veya ndk-build kullanılıyorsa işlem biraz farklıdır. Yerel bağımlılıkları kullanma başlıklı makaleye göz atın.
build.gradle dosyasını güncelleme
Android Gradle eklentisinin 4.1.0 veya daha yeni bir sürümünü kullanırken uygulamanıza Oboe'yu eklemek için uygulamanızın build.gradle dosyasına aşağıdaki eklemeleri yapın.
oboe bağımlılığını dependencies bölümüne ekleyin. Gerekirse 1.5.0 yerine Oboe'nun en son kararlı sürümünü kullanın:
Projenizin derleme ayarlarında aşağıdaki değişiklikleri yapın.
Statik kitaplık
Android Game SDK'sını entegre ettiğinizde, belirli ABI, API düzeyi, NDK ve STL kombinasyonu için derlenmiş bir Oboe kitaplığı sürümüne statik olarak bağlanırsınız:
liboboe.so paylaşılan kitaplığını paketlemeniz gerekmez. Bu da statik bağlamanın çok daha küçük bir kod alanı sağladığı anlamına gelir.
Paylaşılan kitaplık
Statik kitaplık için gereken ABI, API düzeyi, NDK ve STL kombinasyonu ayarlarınızda kullanılamıyorsa bunun yerine paylaşılan kitaplığa bağlayabilirsiniz:
Derleyici ekleme yollarınızı güncellemek ve uygun başlık dosyasını kullanmak için önceki bölümdeki (statik kitaplık hakkında) 1. ve 2. adımları uygulayın.
Bağlayıcı kitaplığı yollarınıza aşağıdaki biçimde bir yol ekleyin:
If you're using CMake, see the gamesdk/samples/bouncyball/app/CMakeLists.txt
file in the downloaded SDK for an example CMake configuration. It includes a
utility file called gamesdk/samples/gamesdk.cmake, which performs final
checks, adds the proper compiler include paths, and generates a target that you
can use to link the library.
To use the gamesdk.cmake utility:
Include this file in your CMakeLists.txt:
// Use a relative or absolute path. For example, /home/yourusername/gamesdk
// or C:\Android\gamesdk.
include("path/to/gamesdk/samples/gamesdk.cmake")
Oyun SDK'sını içeren klasörle add_gamesdk_target işlevini çağırın:
// Use a relative or absolute path.
add_gamesdk_target(PACKAGE_DIR path/to/gamesdk)
Yerel kitaplığınız için target_link_libraries dosyanıza bağımlılık olarak oboe ekleyin:
// The casing of OpenSLES is important.
target_link_libraries(native-lib oboe OpenSLES ...)
CMake'in gelişmiş kullanımı için gamesdk.cmake
kaynak dosyasına bakın.
Sonraki adımlar: Oboe'yu kullanma
Oboe ile ses çalmak veya kaydetmek için bir veya daha fazla ses akışı oluşturup etkinleştirin ve geri çağırmaları kullanarak ses giriş/çıkış cihazlarınız ile uygulamanız arasında ses alışverişi yapın. Oboe'yi kullanma başlıklı makaleyi inceleyin.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-26 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-08-26 UTC."],[],[],null,["There are two ways to incorporate the Oboe library into your project.\n\n- [Integrate Oboe with Gradle and CMake](#integrate-native)\n\n- [Download the Android Game SDK and integrate Oboe manually](#integrate-download)\n\nIntegrate Oboe with Gradle and CMake\n\nThese instructions are for projects using [Android Gradle plugin version 4.1.0 or higher](/studio/releases/gradle-plugin)\nusing [native dependencies](/studio/build/dependencies#using-native-dependencies?buildsystem=cmake)\nwith CMake.\n\nIf your project is using either the Android Gradle plugin version 4.0 or\n`ndk-build` instead of CMake, the process is slightly different. See [Using native dependencies](/studio/build/dependencies#using-native-dependencies?buildsystem=ndk-build&agpversion=4.0).\n| **Note:** Native dependencies have minimum version requirements for Gradle and the Android Gradle plugin. If you have an existing project, you may need to update the project Gradle version to 6.5.0 or later and the Android Gradle plugin version to 4.1.0 or later. For more information on updating these versions, see [Android Gradle plugin release notes](/studio/releases/gradle-plugin).\n\nUpdate build.gradle\n\nTo add Oboe to your app while using Android Gradle plugin version 4.1.0 or\nhigher, make the following additions to your app's `build.gradle` file.\n\n1. Add the `oboe` dependency to the `dependencies` section. If necessary,\n replace `1.5.0` with the [latest stable version](https://github.com/google/oboe/releases/)\n of Oboe:\n\n dependencies {\n implementation 'com.google.oboe:oboe:1.5.0'\n }\n\n2. Enable the `prefab` option in the `buildFeatures` section.\n\n android {\n buildFeatures {\n prefab true\n }\n }\n\n3. Configure your app to use the shared STL:\n\n android {\n defaultConfig {\n externalNativeBuild {\n cmake {\n arguments \"-DANDROID_STL=c++_shared\"\n }\n }\n }\n }\n\nUpdate CMakeLists.txt\n\nAdding Oboe requires two additions to your app's `CMakeLists.txt` file.\n\n1. Add the following `find_package` command:\n\n find_package (oboe REQUIRED CONFIG)\n\n2. Add `oboe::oboe` to the list of libraries passed to the\n `target_link_libraries` command associated with your main executable.\n\nIntegrate with the Android Game SDK\n\n1. [Download the library](https://developer.android.com/games/sdk) and check\n it into your source control system.\n\n2. Make the following changes to your project's build settings.\n\n| **Note:** To use Oboe, you must specify a minimum API level of 16 and NDK release of 18 for the Android Game SDK libraries. If you don't, Oboe can't be found at build time.\n\nStatic library\n\nWhen you integrate with the Android Game SDK, you statically link to a version\nof the Oboe library compiled for the given ABI, API level, NDK, and STL\ncombination:\n\n1. Add `gamesdk/include` to your compiler include paths.\n2. Add a path of the following form in your linker library paths:\n\n ```\n gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release\n ```\n\n For example: `gamesdk/libs/arm64-v8a_API24_NDK18_cpp_static_Release`\n3. Add `-loboe_static` to your linker command.\n\nYou don't need to bundle the `liboboe.so` shared library, which means static\nlinking gives you a much smaller code footprint.\n\nShared library\n\nIf the ABI, API level, NDK, and STL combination required for a static library\nisn't available for your settings, you can link against the shared library\ninstead:\n\n1. Follow steps 1 and 2 from the previous section (about the static library) to\n update your compiler include paths, and use the appropriate header file.\n\n2. Add a path of the following form in your linker library paths:\n\n \u003cbr /\u003e\n\n ```\n gamesdk/libs/architectureAPI\u003cvar translate=\"no\"\u003eapiLevel\u003c/var\u003eNDKndkVersion_stlVersion_Release/lib/oboe\n ```\n3. Add `-loboe -lOpenSLES` to your linker command.\n\nUsing CMake (static library only)\n\nIf you're using CMake, see the `gamesdk/samples/bouncyball/app/CMakeLists.txt`\nfile in the downloaded SDK for an example CMake configuration. It includes a\nutility file called `gamesdk/samples/gamesdk.cmake`, which performs final\nchecks, adds the proper compiler include paths, and generates a target that you\ncan use to link the library.\n\nTo use the `gamesdk.cmake` utility:\n\n1. Include this file in your `CMakeLists.txt`:\n\n // Use a relative or absolute path. For example, /home/yourusername/gamesdk\n // or C:\\Android\\gamesdk.\n include(\"\u003cvar translate=\"no\"\u003epath/to/gamesdk\u003c/var\u003e/samples/gamesdk.cmake\")\n\n2. Call the `add_gamesdk_target` function with the folder containing\n the gamesdk:\n\n // Use a relative or absolute path.\n add_gamesdk_target(PACKAGE_DIR \u003cvar translate=\"no\"\u003epath/to/gamesdk\u003c/var\u003e)\n\n3. In your `target_link_libraries` for your native library, add\n `oboe` as a dependency:\n\n // The casing of OpenSLES is important.\n target_link_libraries(native-lib oboe OpenSLES ...) \n\nFor advanced usage of CMake, see the [`gamesdk.cmake`](https://android.googlesource.com/platform/frameworks/opt/gamesdk/+/refs/heads/master/samples/gamesdk.cmake)\nsource file.\n\nNext steps: using Oboe\n\nTo play or record audio with Oboe, create and activate one or more audio\nstreams, and use callbacks to exchange audio between your audio input/output\ndevices and your app. See [Using\nOboe](https://github.com/google/oboe/blob/master/docs/GettingStarted.md#using-%0Aoboe)."]]