Establishing a robust and intimate mucosal interface that allows medical devices to remain within lumen-confined organs for extended periods has valuable applications, particularly for gastrointestinal theranostics. Here, we report the development of an electroadhesive hydrogel interface for robust and prolonged mucosal retention after electrical activation (e-GLUE). The e-GLUE device is composed of cationic polymers interpenetrated within a tough hydrogel matrix. An e-GLUE electrode design eliminated the need for invasive submucosal placement of ground electrodes for electrical stimulation during endoscopic delivery. With an electrical stimulation treatment of about 1 minute, the cationic polymers diffuse and interact with polyanionic proteins that have a relatively slow cellular turnover rate in the deep mucosal tissue. This mucosal adhesion mechanism increased the adhesion energy of hydrogels on the mucosa by up to 30-fold and enabled in vivo gastric retention of e-GLUE devices in a pig stomach for up to 30 days. The adhesion strength was modulated by polycationic chain length, electrical stimulation time, gel thickness, cross-linking density, voltage amplitude, polycation concentration, and perimeter-to-area ratio of the electrode assembly. In porcine studies, e-GLUE demonstrated rapid mucosal adhesion in the presence of luminal fluid and mucus exposure. In proof-of-concept studies, we demonstrated e-GLUE applications for mucosal hemostasis, sustained local delivery of therapeutics, and intimate biosensing in the gastrointestinal tract, which is an ongoing clinical challenge for commercially available alternatives, such as endoclips and mucoadhesive. The e-GLUE platform could enable theranostic applications across a range of digestive diseases, including recurrent gastrointestinal bleeding and inflammatory bowel disease.