Buen día, estoy aprendiendo a utilizar Android Studio, y me di cuenta que aplicaciones que antes me funcionaban ahora no. Es decir, por ejemplo yo creé un programa simple utilizando SharedPreferences para ver cómo funcionaba, hace un mes aproximadamente. Esa vez funcionó perfecto. Luego actualicé a la última versión de Android Studio. Ayer, para repasar, intenté crear la misma aplicación, y para mí sorpresa la función de guardar el dato ingresado no funcionaba. Esta ya es la tercera vez que me pasa lo mismo, no sé si tal vez deba eliminar Android Studio y descargarlo nuevamente.
package com.example.sharedpreferences;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
private EditText correo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
correo = findViewById(R.id.editTextTextEmailAddress);
SharedPreferences sharedPreferences = getSharedPreferences("datos",
Context.MODE_PRIVATE);
correo.setText(sharedPreferences.getString("mail", ""));
}
public void Guardar(View view){
SharedPreferences preferencias = getSharedPreferences("data", Context.MODE_PRIVATE);
SharedPreferences.Editor Obj_editor = preferencias.edit();
Obj_editor.putString("mail", correo.getText().toString());
Obj_editor.commit();
finish();
}
}
Este es el error que me sale en el Log Cat:
2020-07-31 14:06:55.131 2685-7204/com.google.android.gms.persistent
W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:55.132 2685-7291/com.google.android.gms.persistent
W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:55.132 2685-7291/com.google.android.gms.persistent
W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:55.133 2685-7204/com.google.android.gms.persistent
W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:55.422 1793-2325/? E/GnssHAL_GnssInterface: gnssSvStatusCb:
a: input svInfo.flags is 8
2020-07-31 14:06:55.422 1793-2325/? E/GnssHAL_GnssInterface: gnssSvStatusCb:
b: input svInfo.flags is 8
2020-07-31 14:06:56.423 1793-2325/? E/GnssHAL_GnssInterface: gnssSvStatusCb:
a: input svInfo.flags is 8
2020-07-31 14:06:56.423 1793-2325/? E/GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
2020-07-31 14:06:56.841 1784-4285/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 1099268 , only wrote 1099243
2020-07-31 14:06:56.851 2038-5622/system_process W/InputReader: Device has associated, but no associated display id.
2020-07-31 14:06:56.865 2038-5622/system_process I/chatty: uid=1000(system) Binder:2038_1C identical 18 lines
2020-07-31 14:06:56.865 2038-5622/system_process W/InputReader: Device has associated, but no associated display id.
2020-07-31 14:06:56.900 1794-5923/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
2020-07-31 14:06:56.901 2038-2038/system_process W/ActivityManager: Unable to start service Intent { act=android.service.appprediction.AppPredictionService cmp=com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiPredictionService } U=0: not found
2020-07-31 14:06:56.901 2038-2038/system_process W/RemoteAppPredictionService: could not bind to Intent { act=android.service.appprediction.AppPredictionService cmp=com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiPredictionService } using flags 67108865
2020-07-31 14:06:56.918 1794-5923/? I/chatty: uid=1000(system) HwBinder:1794_3 identical 1 line
2020-07-31 14:06:56.930 1794-5923/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
2020-07-31 14:06:56.931 3248-4485/com.google.android.googlequicksearchbox D/EGL_emulation: eglMakeCurrent: 0xebb0bba0: ver 2 0 (tinfo 0xc2af30c0)
2020-07-31 14:06:56.933 1794-3470/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
2020-07-31 14:06:56.979 1794-5923/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
2020-07-31 14:06:56.989 1794-3470/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
2020-07-31 14:06:56.992 2502-3240/com.google.android.apps.nexuslauncher D/EGL_emulation: eglMakeCurrent: 0xdfa1a900: ver 2 0 (tinfo 0xdfa0fa30)
2020-07-31 14:06:57.038 2038-2073/system_process W/InputReader: Device has associated, but no associated display id.
2020-07-31 14:06:57.038 2038-2073/system_process I/chatty: uid=1000(system) android.anim identical 8 lines
2020-07-31 14:06:57.038 2038-2073/system_process W/InputReader: Device has associated, but no associated display id.
2020-07-31 14:06:57.040 1794-3470/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 5312512
2020-07-31 14:06:57.089 2192-2574/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xf2d7fee0: ver 2 0 (tinfo 0xdc5c0ca0)
2020-07-31 14:06:57.101 3248-3582/com.google.android.googlequicksearchbox W/SessionLifecycleManager: Handover failed. Creating new session controller.
2020-07-31 14:06:57.107 2553-2553/com.google.android.inputmethod.latin I/PhenotypeExpConfig: refreshConfiguration() : Force = false : UpdateAvailable = false : Age = 88 minutes : MaxAge = 720 minutes
2020-07-31 14:06:57.111 2553-2553/com.google.android.inputmethod.latin I/AndroidIME: LatinIme.onDeactivate()
2020-07-31 14:06:57.156 2553-3854/com.google.android.inputmethod.latin D/EGL_emulation: eglMakeCurrent: 0xc4923b20: ver 2 0 (tinfo 0xc4f4bcf0)
2020-07-31 14:06:57.157 2192-2574/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xf2d7fee0: ver 2 0 (tinfo 0xdc5c0ca0)
2020-07-31 14:06:57.158 3248-3612/com.google.android.googlequicksearchbox W/ThreadPoolDumper: Queue length for executor EventBus is now 11. Perhaps some tasks are too long, or the pool is too small.
2020-07-31 14:06:57.187 2192-2574/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xf2d7fee0: ver 2 0 (tinfo 0xdc5c0ca0)
2020-07-31 14:06:57.212 2192-2574/com.android.systemui I/chatty: uid=10108(com.android.systemui) RenderThread identical 1 line
2020-07-31 14:06:57.226 2192-2574/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xf2d7fee0: ver 2 0 (tinfo 0xdc5c0ca0)
2020-07-31 14:06:57.230 2502-2519/com.google.android.apps.nexuslauncher I/s.nexuslaunche: NativeAlloc concurrent copying GC freed 4926(304KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 2937KB/5874KB, paused 1.656ms total 102.278ms
2020-07-31 14:06:57.231 2502-2521/com.google.android.apps.nexuslauncher W/System: A resource failed to call release.
2020-07-31 14:06:57.231 2502-2521/com.google.android.apps.nexuslauncher W/System: A resource failed to call release.
2020-07-31 14:06:57.231 2192-2574/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xf2d7fee0: ver 2 0 (tinfo 0xdc5c0ca0)
2020-07-31 14:06:57.234 3248-8127/com.google.android.googlequicksearchbox W/LocationOracle: No location history returned by ContextManager
2020-07-31 14:06:57.269 2192-2208/com.android.systemui I/ndroid.systemu: NativeAlloc concurrent copying GC freed 120171(2916KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 4850KB/9701KB, paused 565us total 148.051ms
2020-07-31 14:06:57.272 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.292 2685-7291/com.google.android.gms.persistent W/ctxmgr: [AclManager] No 3 for (accnt=account#-517948760#, com.google.android.gms(10102):UserVelocityProducer, vrsn=19275022, 0, 3pPkg = null , 3pMdlId = null , pid = 2685). Was: 3 for 1, account#-517948760# [CONTEXT service_id=47 ]
2020-07-31 14:06:57.297 3248-3582/com.google.android.googlequicksearchbox I/MicroDetectionWorker: #startMicroDetector [speakerMode: 0]
2020-07-31 14:06:57.301 3248-3582/com.google.android.googlequicksearchbox W/ErrorReporter: reportError [type: 211, code: 393244, bug: 0]: errorCode: 393244, engine: 0
2020-07-31 14:06:57.302 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.306 3248-3582/com.google.android.googlequicksearchbox I/MicroDetector: Keeping mic open: false
2020-07-31 14:06:57.306 3248-3582/com.google.android.googlequicksearchbox I/MicroDetectionWorker: #onError(false)
2020-07-31 14:06:57.329 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.332 2685-8122/com.google.android.gms.persistent I/Places: ?: Couldn't find platform key file.
2020-07-31 14:06:57.336 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.398 2038-3043/system_process I/WifiService: acquireWifiLock uid=10102 lockMode=2
2020-07-31 14:06:57.423 1793-2325/? E/GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
2020-07-31 14:06:57.423 1793-2325/? E/GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
2020-07-31 14:06:57.427 2038-3043/system_process I/WifiService: releaseWifiLock uid=10102
2020-07-31 14:06:57.456 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.465 2685-7291/com.google.android.gms.persistent I/ctxmgr: [ProducerStatusImpl] updateStateForNewContextData: inactive, contextName=7 [CONTEXT service_id=47 ]
2020-07-31 14:06:57.502 2685-2685/com.google.android.gms.persistent I/GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_BY_PENDING_INTENT pendingIntent=PendingIntent[creatorPackage=com.google.android.gms], packageName=com.google.android.gms]
2020-07-31 14:06:57.506 2685-7204/com.google.android.gms.persistent I/Places: ?: Couldn't find platform key file.
2020-07-31 14:06:57.507 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.507 2685-8129/com.google.android.gms.persistent I/PlaceInferenceEngine: [anon] Changed inference mode: 0
2020-07-31 14:06:57.508 2685-7204/com.google.android.gms.persistent I/Places: ?: Couldn't find platform key file.
2020-07-31 14:06:57.509 2685-2685/com.google.android.gms.persistent I/GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_BY_PENDING_INTENT pendingIntent=PendingIntent[creatorPackage=com.google.android.gms], packageName=com.google.android.gms]
2020-07-31 14:06:57.536 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.547 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.562 2685-8131/com.google.android.gms.persistent I/Places: ?: Couldn't find platform key file.
2020-07-31 14:06:57.570 2685-8122/com.google.android.gms.persistent I/Places: ?: Couldn't find platform key file.
2020-07-31 14:06:57.583 2038-3354/system_process W/AppOps: Noting op not finished: uid 10102 pkg com.google.android.gms code 41 time=1596215216875 duration=-1596213794457
2020-07-31 14:06:57.591 7908-7934/com.example.sharedpreferences D/EGL_emulation: eglMakeCurrent: 0xebbac4c0: ver 2 0 (tinfo 0xebb2bc40)
2020-07-31 14:06:57.608 2038-5859/system_process D/HostConnection: HostConnection::get() New Host Connection established 0xc30409c0, tid 5859
2020-07-31 14:06:57.608 2038-5859/system_process D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_free_memory_sync GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
2020-07-31 14:06:57.609 2038-5859/system_process W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2020-07-31 14:06:57.614 2038-5859/system_process D/EGL_emulation: eglCreateContext: 0xebbab5c0: maj 2 min 0 rcv 2
2020-07-31 14:06:57.615 2685-8122/com.google.android.gms.persistent I/Places: ?: Couldn't find platform key file.
2020-07-31 14:06:57.618 7908-7908/com.example.sharedpreferences D/AutofillManager: onActivityFinishing(): calling cancelLocked()
2020-07-31 14:06:57.634 2038-5859/system_process D/EGL_emulation: eglMakeCurrent: 0xebbab5c0: ver 2 0 (tinfo 0xc395a0b0)
2020-07-31 14:06:57.645 2685-8129/com.google.android.gms.persistent I/Places: ?: PlacesBleScanner start() with priority 2
2020-07-31 14:06:57.647 2685-8129/com.google.android.gms.persistent I/PlaceInferenceEngine: [anon] Changed inference mode: 1
2020-07-31 14:06:57.648 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.658 2685-3737/com.google.android.gms.persistent I/chatty: uid=10102(com.google.android.gms) FlpThread identical 1 line
2020-07-31 14:06:57.674 2685-3737/com.google.android.gms.persistent W/GCoreFlp: No location to return for getLastLocation()
2020-07-31 14:06:57.697 2685-2685/com.google.android.gms.persistent I/BeaconBle: Client requested scan, settings=BleSettings [scanMode=ZERO_POWER, callbackType=ALL_MATCHES, reportDelayMillis=0, 1 filters, 0 clients, callingClientName=Places]
2020-07-31 14:06:57.699 2685-2685/com.google.android.gms.persistent I/BeaconBle: Scan : No clients left, canceling alarm.
2020-07-31 14:06:57.700 2685-2685/com.google.android.gms.persistent E/BeaconBle: Scan couldn't start for Places
2020-07-31 14:06:57.705 2685-2699/com.google.android.gms.persistent I/.gms.persisten: Background young concurrent copying GC freed 27935(1614KB) AllocSpace objects, 25(1552KB) LOS objects, 20% free, 10MB/13MB, paused 1.388ms total 104.327ms
2020-07-31 14:06:57.708 2685-8122/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.717 2685-8122/com.google.android.gms.persistent I/chatty: uid=10102(com.google.android.gms) lowpool[27] identical 3 lines
2020-07-31 14:06:57.718 2685-8122/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.718 2685-7204/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.718 2685-8122/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.718 2685-7204/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.718 2685-8122/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.719 2685-7204/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.719 2685-7204/com.google.android.gms.persistent I/chatty: uid=10102(com.google.android.gms) lowpool[12] identical 1 line
2020-07-31 14:06:57.720 2685-7204/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.722 2685-8122/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.723 2685-8122/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.724 2685-7204/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.725 2685-7204/com.google.android.gms.persistent I/chatty: uid=10102(com.google.android.gms) lowpool[12] identical 3 lines
2020-07-31 14:06:57.726 2685-7204/com.google.android.gms.persistent W/ClearcutTransmitter: Dropped event; high load or sample rate
2020-07-31 14:06:57.730 2685-2685/com.google.android.gms.persistent W/Places: BLE failure while scanning - code 5