27 Mart 2025'ten itibaren AOSP'yi derlemek ve AOSP'ye katkıda bulunmak için aosp-main
yerine android-latest-release
kullanmanızı öneririz. Daha fazla bilgi için AOSP'de yapılan değişiklikler başlıklı makaleyi inceleyin.
Android için Komut Dosyası Katmanı ile Trade Federation'ı kullanma
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Android için Komut Dosyası Katmanı (SL4A), Android API'lerini platformdan bağımsız bir şekilde çağırmaya yönelik bir otomasyon araç setidir.
Hem adb
aracılığıyla uzaktan otomasyonu hem de bir dizi hafif çeviri katmanı aracılığıyla cihaz üzerinde komut dosyalarının yürütülmesini destekler.
Proje platform/external/sl4a adresindedir.
Kullan
Manuel olarak derleyip yüklemek için SL4A README'yi takip edebilirsiniz. Tradefed üzerinden çalışırken, kullanımı kolaylaştırmak için bazı donanım yardımcı programlarından yararlanabilirsiniz.
İndir ve yükle
İki cihaz kullanan örnek bir Tradefed yapılandırması olan BT-discovery-sl4a.xml dosyasını inceleyerek başlayabilirsiniz. SL4A.apk
, çoğu cihaz derlemesinde tests
klasöründe bulunur.
Yukarıdaki Tradefed örneği, derlemeleri otomatik olarak getirir, her iki cihazı da flaşlar ve SL4A.apk
'ı her iki cihaza da yükler. Bu komutu şu şekilde çalıştırabilirsiniz:
source build/envsetup.sh
lunch
make sl4a
tradefed.sh run google/example/BT-discovery-sl4a
Veya oluşturulduktan sonra:
./tradefed.sh run google/example/BT-discovery-sl4a
SL4A'yı kullanarak Tradefed'de test yazma
Yukarıda açıklanan test örneğini (Sl4aBluetoothDiscovery.java) takip edebilirsiniz.
Bu, Tradefed testinde SL4A'nın kullanılacağı akışa dair iyi bir örnektir.
SL4A API dokümanları
SL4A üzerinden kullanılabilen geri çağırmaların tam listesi oluşturulabilir. SL4A kaynak dizininden platform/external/sl4a/
şu komutu çalıştırın:
python Docs/generate_api_reference_md.py
Dokümanlar dizininde, SL4A'da bulunan RPC işlevlerinin yanı sıra RPC işlevleriyle ilgili dokümanları içeren bir ApiReference.md
dosyası bulunur.
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-07-27 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-07-27 UTC."],[],[],null,["# Use Trade Federation with Scripting Layer for Android\n\nScripting Layer for Android, SL4A, is an\nautomation toolset for calling Android APIs in a platform-independent manner.\nIt supports both remote automation via `adb` and execution of scripts\nfrom on-device via a series of lightweight translation layers.\n\nThe project is located at [platform/external/sl4a](https://android.googlesource.com/platform/external/sl4a/).\n\nUse\n---\n\nYou can follow the [SL4A README](https://android.googlesource.com/platform/external/sl4a/+/refs/heads/android16-release/README.md)\nto build and install it manually. And when running through Tradefed, you\ncan take advantage of some of the harness utilities to make use easier.\n\n### Download and install\n\nYou can start by reviewing\n[BT-discovery-sl4a.xml](https://android.googlesource.com/platform/tools/tradefederation/contrib/+/refs/heads/android16-release/res/config/google/example/BT-discovery-sl4a.xml),\nan example Tradefed configuration that uses two devices. The `SL4A.apk` is\navailable in most device builds within their `tests` folder.\n\nThe Tradefed example above automatically fetches the builds, flashes both\ndevices and installs `SL4A.apk` on both devices. You can run it like so: \n\n source build/envsetup.sh\n lunch\n make sl4a\n tradefed.sh run google/example/BT-discovery-sl4a\n\nOr once built: \n\n ./tradefed.sh run google/example/BT-discovery-sl4a\n\n### Write a test in Tradefed using SL4A\n\nYou can follow the test sample describe above:\n[Sl4aBluetoothDiscovery.java](https://android.googlesource.com/platform/tools/tradefederation/contrib/+/refs/heads/android16-release/src/com/android/tradefed/Sl4aBluetoothDiscovery.java).\nThis gives a good example of the flow to use SL4A within a Tradefed test.\n\n### SL4A API documentation\n\nThe complete list of callbacks available through SL4A can be generated. From the\nSL4A source directory, `platform/external/sl4a/`, run this command: \n\n python Docs/generate_api_reference_md.py\n\nIn the Docs directory there will be an `ApiReference.md` file that contains\nthe RPC functions available in SL4A, as well as documentation for the RPC\nfunctions."]]