À partir du 27 mars 2025, nous vous recommandons d'utiliser android-latest-release
au lieu de aosp-main
pour créer et contribuer à AOSP. Pour en savoir plus, consultez la section Modifications apportées à AOSP.
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
InstallApkSetup
public
class
InstallApkSetup
extends BaseTargetPreparer
ITargetPreparer
qui installe un ou plusieurs APK situés sur le système de fichiers.
Cette classe ne doit être utilisée que pour installer des APK à partir du système de fichiers lorsque toutes les versions du test reposent sur l'existence de l'APK sur le système de fichiers. Pour les tests qui utilisent TestAppInstallSetup
pour installer des APK à partir du fichier ZIP de test, utilisez --alt-dir
pour spécifier un autre répertoire sur le système de fichiers contenant l'APK pour d'autres configurations de test (par exemple, des exécutions locales où le fichier ZIP de test n'est pas présent).
Résumé
Constructeurs publics
InstallApkSetup
public InstallApkSetup ()
Méthodes publiques
setApkPaths
public void setApkPaths ( paths)
Définit les chemins d'accès aux APK. Exposé à des fins de test.
setThrowIfInstallFail
public void setThrowIfInstallFail (boolean throwIfInstallFail)
Définissez l'exception en cas d'échec de l'installation. Exposé à des fins de test.
Paramètres |
throwIfInstallFail |
boolean |
setUp
public void setUp (ITestDevice device,
IBuildInfo buildInfo)
Paramètres |
device |
ITestDevice |
buildInfo |
IBuildInfo |
Méthodes protégées
getApkPaths
protected getApkPaths ()
Le contenu et les exemples de code de cette page sont soumis aux licences décrites dans la Licence de contenu. Java et OpenJDK sont des marques ou des marques déposées d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/27 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/07/27 (UTC)."],[],[],null,["# InstallApkSetup\n===============\n\n\n`\npublic\n\n\nclass\nInstallApkSetup\n`\n\n\n`\n\n\n`\n\n`\n\nextends `[BaseTargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/BaseTargetPreparer.html)`\n\n\n`\n\n`\n\n\n`\n\n|---|---|-------------------------------------------------|\n| java.lang.Object |||\n| ↳ | [com.android.tradefed.targetprep.BaseTargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/BaseTargetPreparer.html) ||\n| | ↳ | com.android.tradefed.targetprep.InstallApkSetup |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA [ITargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/ITargetPreparer.html) that installs one or more apks located on the filesystem.\n\nThis class should only be used for installing apks from the filesystem when all versions of\nthe test rely on the apk being on the filesystem. For tests which use [TestAppInstallSetup](../../../../../../reference/tradefed/com/android/tradefed/targetprep/TestAppInstallSetup.html)\nto install apks from the tests zip file, use `--alt-dir` to specify an alternate directory\non the filesystem containing the apk for other test configurations (for example, local runs where\nthe tests zip file is not present).\n\nSummary\n-------\n\n| ### Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[InstallApkSetup](../../../../../../reference/tradefed/com/android/tradefed/targetprep/InstallApkSetup.html#InstallApkSetup())`() ` |\n\n| ### Public methods ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[setApkPaths](../../../../../../reference/tradefed/com/android/tradefed/targetprep/InstallApkSetup.html#setApkPaths(\u003cany\u003e))`(` paths) Sets APK paths. |\n| ` void` | ` `[setThrowIfInstallFail](../../../../../../reference/tradefed/com/android/tradefed/targetprep/InstallApkSetup.html#setThrowIfInstallFail(boolean))`(boolean throwIfInstallFail) ` Set throw if install fail. |\n| ` void` | ` `[setUp](../../../../../../reference/tradefed/com/android/tradefed/targetprep/InstallApkSetup.html#setUp(com.android.tradefed.device.ITestDevice,%20com.android.tradefed.build.IBuildInfo))`(`[ITestDevice](../../../../../../reference/tradefed/com/android/tradefed/device/ITestDevice.html)` device, `[IBuildInfo](../../../../../../reference/tradefed/com/android/tradefed/build/IBuildInfo.html)` buildInfo) ` |\n\n| ### Protected methods ||\n|-----|--------------------------------------------------------------------------------------------------------------------------------|\n| ` ` | ` `[getApkPaths](../../../../../../reference/tradefed/com/android/tradefed/targetprep/InstallApkSetup.html#getApkPaths())`() ` |\n\nPublic constructors\n-------------------\n\n### InstallApkSetup\n\n```\npublic InstallApkSetup ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### setApkPaths\n\n```\npublic void setApkPaths ( paths)\n```\n\nSets APK paths. Exposed for testing.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|--------|\n| `paths` | \u003cbr /\u003e |\n\n### setThrowIfInstallFail\n\n```\npublic void setThrowIfInstallFail (boolean throwIfInstallFail)\n```\n\nSet throw if install fail. Exposed for testing.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------------|------------------|\n| `throwIfInstallFail` | `boolean` \u003cbr /\u003e |\n\n### setUp\n\n```\npublic void setUp (ITestDevice device, \n IBuildInfo buildInfo)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------|----------------------|\n| `device` | `ITestDevice` \u003cbr /\u003e |\n| `buildInfo` | `IBuildInfo` \u003cbr /\u003e |\n\n| Throws ||\n|----------------------------------------------------------------------------------------------------------------------------------|---|\n| [BuildError](../../../../../../reference/tradefed/com/android/tradefed/targetprep/BuildError.html) | |\n| [DeviceNotAvailableException](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceNotAvailableException.html) | |\n| [TargetSetupError](../../../../../../reference/tradefed/com/android/tradefed/targetprep/TargetSetupError.html) | |\n\nProtected methods\n-----------------\n\n### getApkPaths\n\n```\nprotected getApkPaths ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|--------|\n| | \u003cbr /\u003e |"]]