Od 27 marca 2025 r. zalecamy używanie android-latest-release zamiast aosp-main do kompilowania i wspołtworzenia AOSP. Więcej informacji znajdziesz w artykule o zmianach w AOSP.
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Po skompilowaniu Androida sprawdź, czy możesz zmienić wartość flagi aconfig.
Aby zmienić wartość flagi aconfig w czasie wykonywania:
Upewnij się, że urządzenie jest włączone i połączone z komputerem deweloperskim.
Sprawdź bieżące ustawienie flagi:
adbshellaflagslist|greppackage.flagname
Jeśli flaga jest włączona, a kod jest wykonywany, przejdź do kroku 4, aby ją wyłączyć. Jeśli flaga jest wyłączona, przejdź do kroku 6, aby włączyć kod.
Wyłącz kod. W wierszu poleceń uruchom:
adb shell aflags disable your.full.flag.name
Aby na przykład wyłączyć flagę append_injected_content, uruchom:
Sprawdź stan kodu, próbując go uruchomić na urządzeniu lub ponownie uruchomić polecenie aflags list:
adbshellaflagslist|greppackage.flagname
Jeśli kod był włączony, powinien zostać wyłączony. Jeśli kod został wyłączony, musisz go włączyć.
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-27 UTC."],[],[],null,["# Change a flag's value at runtime\n\nAfter building Android, ensure that you can change the aconfig flag's value.\n| **Note:** Only the value for an aconfig read-write flag can be changed at runtime.\n\nTo change an aconfig flag value at runtime:\n\n1. Ensure your device is running and connected to your development machine.\n2. Check to see the flag's current setting:\n\n adb shell aflags list | grep package.flagname\n\n3. If the flag is enabled and your code is executing, continue with step 4 to\n disable the flag. If the flag is disabled, skip to step 6 to enable your code.\n\n4. Disable your code. From the command line, run:\n\n adb shell aflags disable \u003cvar translate=\"no\"\u003eyour.full.flag.name\u003c/var\u003e\n\n For example, to disable the `append_injected_content` flag, run: \n\n adb shell aflags disable com.example.android.aconfig.demo.flags.append_injected_content\n\n5. Skip to step 7.\n\n6. Enable your code. From the command line, run:\n\n adb shell aflags enable \u003cvar translate=\"no\"\u003eyour.full.flag.name\u003c/var\u003e\n\n For example, enable the `append_injected_content` flag, run: \n\n adb shell aflags enable com.example.android.aconfig.demo.flags.append_injected_content\n\n7. Reboot the device:\n\n adb reboot\n\n8. Check the status your code either by attempting to execute it on the device\n or by rerunning the `aflags list` command again:\n\n adb shell aflags list | grep package.flagname\n\n If your code was enabled, it should be disabled. Conversely, if your code was\n disabled, it should be enabled."]]