Where Android apps store data?

文章推薦指數: 80 %
投票人數:10人

All apps (root or not) have a default data directory, which is /data/data/ . By default, the apps databases, settings, and all other data go ... AndroidEnthusiastsStackExchangeisaquestionandanswersiteforenthusiastsandpowerusersoftheAndroidoperatingsystem.Itonlytakesaminutetosignup. Signuptojointhiscommunity Anybodycanaskaquestion Anybodycananswer Thebestanswersarevotedupandrisetothetop Home Public Questions Tags Users Unanswered FindaJob Jobs Companies Teams StackOverflowforTeams –Collaborateandshareknowledgewithaprivategroup. CreateafreeTeam WhatisTeams? Teams CreatefreeTeam Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore WhereAndroidappsstoredata? AskQuestion Asked 8years,5monthsago Active 6monthsago Viewed 613ktimes 131 72 CouldyoulistallpossibledirectorieswhereAndroidappsmaystoredata,providingdescriptionwhatkindofdataarestoredineachdirectory? applicationsfile-systemstorage Share Improvethisquestion Follow editedJun25'13at12:54 GAThrawn 22k99goldbadges7575silverbadges125125bronzebadges askedJun25'13at10:00 zdunyzduny 1,62733goldbadges1313silverbadges1010bronzebadges 2 1 Seealso:ListofspecialAndroidSDcardfolders?/IsitpossibletoreorganizetheSDcard?Becauseitisamessinthere/WhichdirectoriescanIremoveininternalSD?/Checkwhatstorageanappuses? – GAThrawn Jun25'13at13:06 PlusAndroidFolderHiearchy/WhereonthefilesystemareSMSmessagesstored?/Whereinthefilesystemareapplicationsinstalled? – Izzy ♦ Jun25'13at15:33 Addacomment  |  3Answers 3 Active Oldest Votes 118 Allapps(rootornot)haveadefaultdatadirectory,whichis/data/data/.Bydefault,theappsdatabases,settings,andallotherdatagohere.Thisdirectoryis"private"totheapp–whichmeansnootherappandnoteventheusercanaccessdatainit(withoutrootpermissions). Ifanappexpectshugeamountsofdatatobestored,orforotherreasonswantsto"benicetointernalstorage",there'sacorrespondingdirectoryontheSDCard(Android/data/). Apartfromthat,allappscanstoredataanywhereontheSDCard,astherearenorestrictions--andmanyappsdoso.Theycanusedirectorynamesfreely(andtheyagaindo),whichiswhatoftenmakesithardtodecidewhatallthat"junk"onthecardisintendedfor,andwhatofitcanbedeleted. Though,asTompointedout,root-appscouldstoretheirdataalmosteverywhereonyourdevice,theyusuallyfollowthesamerulesasotherapps. YoucanfindageneralexplanationoftheAndroiddirectoryhierarchyinmyanswerhere.ForyourspecificquestionImightaddsomemoredetailsonthe/data/data/(andcorrespondingSD-part): databases/:heregotheapp'sdatabases lib/:librariesandhelpersfortheapp files/:otherrelatedfiles shared_prefs/:preferencesandsettings cache/:well,caches Theremightbeseveralmoredirectoriesinthisplace,orfewer--italldependsontheapp.Initsown"homedirectory"(andthat'swhatitbasicallyis,spokenLinux-wise)theycanplacefileswheretheywant.Usually,thesefilesanddirectoriesareonlyaccessiblebytheappitself(androot,ofcourse)--otherthanthosestoredontheSDCard,whichareaccessiblebyallapps. Share Improvethisanswer Follow editedMay16at17:08 answeredJun25'13at15:46 Izzy♦Izzy 87.9k6969goldbadges319319silverbadges889889bronzebadges 2 Commentsarenotforextendeddiscussion;thisconversationhasbeenmovedtochat. – AndrewT. ♦ Dec11'20at12:58 1 AndthenalongcameAndroid11withscopedstorage. – vesperto Aug19at10:35 Addacomment  |  25 +200 SomemajorchangesoccurredtostorageinAndroid4.4(seeAndroid'sStorageJourney).SothefollowingisgenerallytrueforAndroid4.4+andparticularly6+. ThisisfrommydetailedanswertoHowdiskspaceisusedonAndroiddevice?.Apps'filesaresaved(bysystemandappitself)tointernalandexternalstorageunderdifferentcategories. DIRECTORYDESCRIPTION/API ===================================================================================== APPCODE ======== /data/app/*(userappsinstallationdirectory) /data/app/*/base.apk(original`.apk`file) /data/app/*/lib//*.so(sharedlibraries) /data/app/*/oat//base.[art|odex|vdex](compiledexecutablecode) /data/dalvik-cache//*.[art|dex|oat|vdex](compiledexecutablecode,onlyforsystemapps) /data/misc/profiles/cur///primary.prof(ARTprofile) /data/misc/profiles/ref//primary.prof(ARTprofile) INTERNALSTORAGE ================ /data/user[_de]//getDataDir /data/user[_de]///filesgetFilesDir /data/user[_de]///[code_]cachegetCacheDirorgetCodeCacheDir /data/user[_de]///databasesgetDatabasePath /data/user[_de]///no_backupgetNoBackupFilesDir /data/user[_de]///shared_prefsgetSharedPreferences EXTERNALSTORAGE ================ /storage/emulated/obb//*.obb(sharedbymulti-users,exposedinfollowingview) /storage/emulated//Android/obb//*..obbgetObbDirs /storage/emulated//Android/media/getExternalMediaDirs /storage/emulated//Android/data// /storage/emulated//Android/data//filesgetExternalFilesDirs /storage/emulated//Android/data//[code_]cachegetExternalCacheDirs Alloftheabovepathsoninternalandexternalstorage(primaryandsecondary)areapp'sprivatedirectorieswhichareaccessibletorespectiveappwithoutrequestinganypermission.Appscanalsocreateotherdirectories(notexplicitlyavailablethroughAPIs)intheirprivatestorage.Allofthesedirectoriesbelongingtoanapparedeletedwhentheappisuninstalled. Additionallyappscanputtheirdataanywhereonprimaryexternalstorage(includingsomestandarddirectoriesandotherapps'privatedirectories)ifWRITE_EXTERNAL_STORAGEpermissionisgranted(getExternalStorageDirectoryreturns/storage/emulated/).ForsecondaryexternalstorageandremovablestorageSAFisused.SeedetailsinHowtosavefilestoexternalSDcard?. HoweverinAndroid10writingdirectlytoprimaryexternalsharedstorageisdeprecated(getExternalStorageDirectoryandgetExternalStoragePublicDirectoryarenomoreavailable).AppsneedtouseoneofAndroid'sbuilt-incontentproviders;eitherMediaStore(formediafiles)orSAF(foranyothertypeoffiles). /datapathsmaygetreplacedwith/mnt/expand/[UUID]whenusingAdoptableStorage./storage/emulatedgetsreplacedwith/storage/[UUID]whenusingsecondaryexternalstorage(likeSDcard). Formultipleusers/profilesisdifferent,deviceownerisalways0./data/user/0isasymlinkto/data/dataforhistoricalreasons.Secondaryexternalstorageisonlyavailabletodeviceowner. OBBdirectoryissharedamongusers/profiles(uptoAndroid9)tosavespace.FUSE/sdcardfsalwaysexposes/storage/emulated/obbas/storage/emulated//Android/obb. /data/user_deistheDeviceEncryptedstorageonFBEdeviceswhichletscertainappsrunonbootwithoutaskingforusercredentials. /data/misc/profilesareusedbyARTforprofile-guidedcompilationofappcode. Descriptionofeachdirectoryissomewhatevidentfromnames,detailscanbeseeninAPIdocumentation. CachesareclearedbyOSwhenrunninglowonstorage,keepingappsexceedingtheallottedquotaontop. Apps'privatefilesdirectoriesinexternalstoragearen'tautomaticallyscannedbyMediaScannerbutmediadirectoriesare. Cachesandno_backupdirectoriesarenotbackeduptocloud.Seeofficialdocumentation. Share Improvethisanswer Follow editedDec29'20at16:58 Firelord♦ 22.7k1818goldbadges110110silverbadges254254bronzebadges answeredNov13'19at0:29 IrfanLatifIrfanLatif 16.2k33goldbadges3939silverbadges137137bronzebadges 2 Whereis/data?NotfoundinwindowsexplorerdisplayingtheinternalstoragewhenconnectedtheandroidphonetoPC. – zwcloud Sep24at4:16 2 @zwcloudSeeHowdiskspaceisusedonAndroiddevice?andWhyaresuperuserpermissionsneededtoacess/datapartition? – IrfanLatif Sep24at4:35 Addacomment  |  9 Theanswertoyourquestionyouareaskingistoobig.Ican,however,giveyouabasicanswerwhichcoversthebasics. Therearetwokindsofapps: Rootandnon-root. Rootappscanbasicallystore/modifyfileswherevertheywant. Non-rootappscanonlystore/modifyfileshere:/sdcard/andeveryfolderwhatcomesafter.Mostly,theinstalledappsstorethemselvesat/sdcard/Android/dataor/sdcard/Android/obb.Someappsstoretheirsavegames/configurationdatafileson/sdcard/APPNAME/,orjustonthe/sdcard/ Tobeabletouserootapps,you'llneedtohaverootedyourAndroiddeviceandhavegivenpermissionfromoneofthesuperuserapps. Share Improvethisanswer Follow answeredJun25'13at10:14 TomTom 48433silverbadges88bronzebadges Addacomment  |  Highlyactivequestion.Earn10reputation(notcountingtheassociationbonus)inordertoanswerthisquestion.Thereputationrequirementhelpsprotectthisquestionfromspamandnon-answeractivity. Nottheansweryou'relookingfor?Browseotherquestionstaggedapplicationsfile-systemstorageoraskyourownquestion. TheOverflowBlog Whoownsthisoutage?BuildingintelligentescalationchainsformodernSRE Podcast395:Whoisbuildingcloudsfortheindependentdeveloper? FeaturedonMeta Nowlive:Afullyresponsiveprofile Reducingtheweightofourfooter Linked 0 whereisthelocationofgoogledrivefolderinandroidphone 0 WhereareWhatsAppmessagesstored? 1 WhatfolderareGooglePodcastsdownloadsstoredin? 0 WherecanIfindUserDataofanapp? 0 HowdoIcorrectlybackupandroidappswithaPCforafactoryreset? 0 Gettheactualapp'sdatafileslocation 1 Cantdeletesystemfilesonrootedphone 0 UnderstandingAndroidappdatastorageareas 1 Whythere'san"Android"folderinmyphone'sstorage? 0 Thenormaldirectoriesofstorageofthisappisempty.Doesitgotanythingtodowithmyphonebeingunrooted? Seemorelinkedquestions Related 64 WherecanfindolderversionsofApps? 5 WhereistheHomefolder? 1 WheredoIstoremyfilessuchthattheycanbefound? 0 Appsstoresettings/cache(theAndroiddirectory)onSDcardeventhoughit'snotwheretheyreside? 6 WheredoAndroidappsstoredatathatsurvivesuninstall? 0 Androidcalendardatastorage&transfer 0 Android-isthereanynegativeimpactwhenyouwipeoutRAMandCACHEdataforallAppsatonce? 0 Appsrecentlychanged,withoutanupdatefromthestore HotNetworkQuestions Doestheabbreviation“ſ.”inthis1755workmean“sine”? HowdoIdownloadthedesktopversionofUbuntu21.10forARM? CollectingalternativeproofsfortheoddityofCatalan Dostateswithinfiniteaverageenergymakesense? HowdoesoneplayaChaoticEvilcharacterwithoutdisruptingtheplaygroup? TheWitch'sBroom Whydoweneedinsulationmaterialbetweentwowalls? HowcanInotgetunfairlyblamedforthingsbymyboss? Foraspacecraftorbitingaplanet,orbitalspeedisinverselyproportionaltoorbitradius.Butspeedmustbeincreasedtoincreaseorbitradius? Whydidn'ttheEnterprise-DsendaprobetolookforPicard? Sci-fistorywherepeoplearereincarnatedathubsandamanwantstofigureoutwhatishappening WhyarelegaldecisionsintheUSsopoliticized? Questionabouttheabbreviationfor2instrumentsinanorchestrascore Whyisthecurrententeringaconductorthesameastheoneexitingit? IsitlegalintheUStoleaveaguninthehandsofaminorwithoutoversight? ConvertcodepointtoUTF-1 DoesaserverneedaGPU? CanImakeahelixwith4strands? compassandstraightedgeinacientGreek? AreJapaneseprincessesandprincesreferredtobyadifferentwordinJapanesethanprincessesandprincesoutsideofJapan? Datastructurethatsupportsinsertionandfastrandomelementlookup Whydoesmanhaveitsownuser? Couldaplantcaptureaperson? Howcomethereisinflationinamodelwithnomoney? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings  



請為這篇文章評分?