[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-26 (世界標準時間)。"],[],[],null,["This page describes how to run an end-to-end test using a demo app and the\nGoogle Play Console.\n\nSteps\n\nTo download the SDK, run the demo app, verify the app is working correctly, and\nview frame timing information from the app in the Google Play Console, do the\nfollowing:\n\n1. Clone the main branch of the [Android Open Source Project](https://android.googlesource.com/platform/frameworks/opt/gamesdk/) Games SDK Repository.\n2. Build and run the demo app.\n3. Run the monitor app.\n4. Create a release build.\n5. Run the release build.\n6. View the graphs in the Google Play Console.\n\nBuild and run the demo app\n\nRun the APT Insights Demo app in Android Studio to make sure everything\nbuilds correctly. This project uses CMake for native code building and shows how\nto use the `gamesdk.cmake` file, which is the easiest way to get started.\n\nTo run the demo app, do the following:\n\n1. Open Android Studio.\n2. Click **File \\\u003e Open** and select `gamesdk/samples/tuningfork/insightsdemo/build.gradle`.\n3. Wait for Android Studio to sync the project.\n4. Connect a device (or [create a virtual device](/studio/run/managing-avds)) to run the sample. Enable [developer options and USB debugging](/studio/debug/dev-options#enable) on the device.\n5. Select the target device and click **Run**\n .\n For more information, see [Build and run your app](/studio/run).\n\n **Figure 1.** Test app running successfully\n6. The sample APK should build and install on the target device. If you\n encounter errors, check the following:\n\n - You have a [supported version](/games/sdk#requirements) of the Android SDK; see the `compileSdkVersion` field in the app module `build.gradle` file for more information. You can [update the SDK version](/studio/intro/update#sdk-manager) from the **SDK Platforms** tab in the SDK Manager.\n - You have a [supported version](/games/sdk#requirements) of the Android NDK; see the `ndkVersion` field in the app module `build.gradle` file for more information. You can [install a specific version of the NDK](/studio/projects/install-ndk#specific-version) from the **SDK Tools** tab in the SDK Manager.\n - The `local.properties` file in the project does *not* have an entry for `ndk.dir`. This location is specified by Android Studio and uses the NDK version from above. If you have this entry, clear the entire line.\n - After any build setting change, clean the project (**Build \\\u003e Clean\n Project** ) and refresh the linked C++ projects (**Build \\\u003e Refresh Linked\n C++ Projects**).\n\nRun the monitor app\n\nWith a debug build of the demo app or any other Tuning Fork-enabled app,\nyou can configure the app to send and receive data from a local endpoint rather\nthan the Google Play server. To do this, set the `endpoint_uri_override` in\nthe Tuning Fork settings: \n\n #ifndef NDEBUG\n settings.endpoint_uri_override = \"http://localhost:9000\";\n #endif\n\nYou must also include the following permissions in the `AndroidManifest.xml`\nfile: \n\n \u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n \u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\n\nThe demo app already has these changes (see [`insightsdemo.cpp`](https://android.googlesource.com/platform/frameworks/opt/gamesdk/+/refs/heads/master/samples/tuningfork/insightsdemo/app/src/main/cpp/insightsdemo.cpp)).\n\nYou can use this feature to verify that an app is sending and receiving the\nproper data. To verify this, run the demo app and the Tuning Fork Monitor app at\nthe same time. This monitoring app acts as a local server and displays the data\nthat a Tuning Fork-enabled app produces.\n\nTo run the monitoring app and demo app at the same time to verify that the demo\napp is working properly, do the following:\n\n1. Install the Tuning Fork Monitor app APK on the target device using [adb](/studio/command-line/adb): \n\n ```\n adb install gamesdk/gamesdk/apks/tools/TuningForkMonitor.apk\n ```\n2. Open the monitoring app.\n3. Press the Android Home button to send the Tuning Fork Monitor app to the background on the device.\n4. [Run the demo app](#run-demo-app) again in the foreground for about 30 seconds.\n5. Switch back to the Tuning Fork Monitor app.\n6. The demo app appears under **Live Applications** as `com.tuningfork.insightsdemo 16`. Tap this entry to see app details and live telemetry.\n\n**Figure 2.** The monitor app detects the demo app \n**Figure 3.** The monitor app displays data from the demo app\n\nCreate a release build\n\nCreate a release build of the demo app in Android Studio. You upload this build\nto the Google Play Console to enable frame timing graphs in Android Vitals.\n\n1. [Enable the Android Performance Parameters API](/games/sdk/performance-tuner/custom-engine/enable-api)\n in Google Cloud Console. This API enables the app to communicate with\n Google Play. You don't need to restrict the API key for the demo app.\n\n2. Make sure to copy your API key from the previous step into the `api_key`\n field in\n `gamesdk/samples/tuningfork/insightsdemo/app/src/main/assets/tuningfork/tuningfork_settings.txt`.\n\n3. The demo app's application ID is reserved, so can't upload an APK that uses\n it. Change this ID in the app's `build.gradle` file:\n\n ```\n applicationId \"com.tuningfork.your-unique-identifier\"\n ```\n4. Clean the project (**Build \\\u003e Clean Project** ) and refresh the linked C++\n projects (**Build \\\u003e Refresh Linked C++ Projects**).\n\n5. Create a signing configuration for release builds.\n\n 1. Select **File \\\u003e Project Structure \\\u003e Modules**.\n 2. Select the **Signing Configs** tab.\n 3. Add a new configuration named `release`.\n 4. [Create a keystore](/studio/publish/app-signing#generate-key) for the configuration.\n6. Associate the release signing configuration with the release build variant.\n\n 1. Select **File \\\u003e Project Structure \\\u003e Build Variants**.\n 2. Select the **Build Types** tab.\n 3. Select the build type named `release`.\n 4. In the **Signing Config** box, select the release configuration variable.\n7. In the Android Studio project window, select the **app** directory. (This\n selection enables the menu selection in the next step.)\n\n8. Change the active build variant to `release` (**Build \\\u003e Select Build\n Variant**).\n\n9. Select **Build \\\u003e Build Bundles(s)/APK(s) \\\u003e Build APK(s)** . When the build\n completes, click the **locate** link to find the release APK.\n\n10. Create a new application for the demo app in the Google Play Console. For\n more information, see\n [Upload an app](https://support.google.com/googleplay/android-developer/answer/113469).\n\n11. Upload the release APK to the **Internal test track** . For more information,\n see\n [Prepare \\& roll out releases](https://support.google.com/googleplay/android-developer/answer/7159011).\n\n | **Note:** You must upload the APK to an internal test track on Google Play. If you do not, privacy filters block the associated graph from appearing.\n\nRun the release build\n\nSelect the target device and click **Run**\n.\nYou must use the same release APK that you uploaded to the\nGoogle Play Console.\n\nLet the demo app run for awhile. It can take up to 30 minutes for the Google\nPlay Console to start displaying data. Verify that data is uploading to the\nserver by selecting the **Info** log level in the **Logcat** window. If you see\nerrors in the log, see\n[Troubleshoot common errors](/games/sdk/performance-tuner/custom-engine/troubleshooting). \n\n ... I/TuningFork:Web: Connecting to:\n https://performanceparameters.googleapis.com/v1/applications/com.tuningfork.yourapp/apks/24:uploadTelemetry\n ... I/TuningFork: Scene loading 30 (true) took 166 ms\n ... I/TuningFork:Web: Response code: 200\n ... I/TuningFork:Web: Response message: OK\n ... I/TuningFork.GE: UPLOAD request returned 200 {}\n\n| **Note:** Make sure to run the release build variant or else data won't upload to the Google Play Console.\n\nView the graphs in the Google Play Console\n\nOpen the Google Play Console and select the test application. Select **Android\nVitals \\\u003e Performance \\\u003e Insights** to see the frame time graph.\n\n\n**Figure 4.** Android vitals graph\n\nYou have successfully run an end-to-end test with the Tuning Fork\nlibrary. You can delete the test app project in the Google Play Console, as it\nis no longer needed."]]