reales - libro de android studio en español pdf
Error de estudio de Android java.lang.IllegalArgumentException: el nombre del recurso no puede estar vacío (3)
Vaya a Archivo> Invalidar caches / reiniciar.
¡Podría ayudar! ¡Gracias!
Estoy intentando reabrir un proyecto anterior de Android Studio en la versión 3.0.
Se compila y se inicia correctamente, pero si trato de editar un diseño en el diseñador de diseño, no se cargará y simplemente sigue diciendo que está esperando que termine la compilación (que tiene).
Cuando miro los errores IDE, veo este error:
provider: org.jetbrains.android.augment.AndroidPsiAugmentProvider@2180343: Resource name cannot be empty.
Mientras miro la información de seguimiento, no veo nada que señale mi proyecto.
¿Alguna sugerencia?
Aquí está la salida de rastreo completa:
provider: org.jetbrains.android.augment.AndroidPsiAugmentProvider@2180343: Resource name cannot be empty.
java.lang.IllegalArgumentException: Resource name cannot be empty.
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
at com.android.ide.common.res2.ResourceItem.<init>(ResourceItem.java:115)
at com.android.ide.common.res2.IdGeneratingResourceParser$IdResourceItem.<init>(IdGeneratingResourceParser.java:202)
at com.android.ide.common.res2.IdGeneratingResourceParser.<init>(IdGeneratingResourceParser.java:81)
at com.android.ide.common.res2.ResourceSet.createResourceFile(ResourceSet.java:456)
at com.android.ide.common.res2.ResourceSet.createFileAndItems(ResourceSet.java:111)
at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:257)
at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:52)
at com.android.ide.common.res2.DataSet.loadFile(DataSet.java:275)
at com.android.tools.idea.res.ResourceFolderRepository$InitialScanState.loadFile(ResourceFolderRepository.java:325)
at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFile(ResourceFolderRepository.java:524)
at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFolder(ResourceFolderRepository.java:477)
at com.android.tools.idea.res.ResourceFolderRepository.scanResFolder(ResourceFolderRepository.java:449)
at com.android.tools.idea.res.ResourceFolderRepository.scanRemainingFiles(ResourceFolderRepository.java:375)
at com.android.tools.idea.res.ResourceFolderRepository.<init>(ResourceFolderRepository.java:119)
at com.android.tools.idea.res.ResourceFolderRepository.create(ResourceFolderRepository.java:152)
at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:76)
at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:64)
at com.android.tools.idea.res.ModuleResourceRepository.create(ModuleResourceRepository.java:95)
at com.android.tools.idea.res.ResourceRepositories.lambda$getModuleResources$2(ResourceRepositories.java:98)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
at com.android.tools.idea.res.ResourceRepositories.getModuleResources(ResourceRepositories.java:95)
at com.android.tools.idea.res.ModuleResourceRepository.findModuleResources(ModuleResourceRepository.java:71)
at com.android.tools.idea.res.ModuleResourceRepository.getOrCreateInstance(ModuleResourceRepository.java:59)
at com.android.tools.idea.res.ProjectResourceRepository.computeRepositories(ProjectResourceRepository.java:81)
at com.android.tools.idea.res.ProjectResourceRepository.create(ProjectResourceRepository.java:73)
at com.android.tools.idea.res.ResourceRepositories.lambda$getProjectResources$1(ResourceRepositories.java:83)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
at com.android.tools.idea.res.ResourceRepositories.getProjectResources(ResourceRepositories.java:80)
at com.android.tools.idea.res.ProjectResourceRepository.findProjectResources(ProjectResourceRepository.java:63)
at com.android.tools.idea.res.ProjectResourceRepository.getOrCreateInstance(ProjectResourceRepository.java:51)
at com.android.tools.idea.res.AppResourceRepository.computeRepositories(AppResourceRepository.java:156)
at com.android.tools.idea.res.AppResourceRepository.create(AppResourceRepository.java:123)
at com.android.tools.idea.res.ResourceRepositories.lambda$getAppResources$0(ResourceRepositories.java:68)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
at com.android.tools.idea.res.ResourceRepositories.getAppResources(ResourceRepositories.java:65)
at com.android.tools.idea.res.AppResourceRepository.findAppResources(AppResourceRepository.java:117)
at com.android.tools.idea.res.AppResourceRepository.getOrCreateInstance(AppResourceRepository.java:99)
at org.jetbrains.android.dom.converters.ResourceReferenceConverter.getResourceTypesInCurrentModule(ResourceReferenceConverter.java:262)
at org.jetbrains.android.augment.AndroidPsiAugmentProvider.getAugments(AndroidPsiAugmentProvider.java:67)
at com.intellij.psi.augment.PsiAugmentProvider.lambda$collectAugments$0(PsiAugmentProvider.java:93)
at com.intellij.psi.augment.PsiAugmentProvider.forEach(PsiAugmentProvider.java:137)
at com.intellij.psi.augment.PsiAugmentProvider.collectAugments(PsiAugmentProvider.java:92)
at com.intellij.psi.impl.source.ClassInnerStuffCache.getAllInnerClasses(ClassInnerStuffCache.java:139)
at com.intellij.psi.impl.source.ClassInnerStuffCache.lambda$getInnerClasses$3(ClassInnerStuffCache.java:72)
at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:141)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:137)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:127)
at com.intellij.psi.impl.source.ClassInnerStuffCache.getInnerClasses(ClassInnerStuffCache.java:71)
at com.intellij.psi.impl.source.ClassInnerStuffCache.getInnerClassesMap(ClassInnerStuffCache.java:182)
at com.intellij.psi.impl.source.ClassInnerStuffCache.lambda$findInnerClassByName$6(ClassInnerStuffCache.java:102)
at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:141)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:137)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:127)
at com.intellij.psi.impl.source.ClassInnerStuffCache.findInnerClassByName(ClassInnerStuffCache.java:101)
at com.intellij.psi.impl.source.PsiClassImpl.findInnerClassByName(PsiClassImpl.java:396)
at org.jetbrains.android.util.AndroidResourceUtil.findResourceFieldsFromClass(AndroidResourceUtil.java:190)
at org.jetbrains.android.util.AndroidResourceUtil.findResourceFields(AndroidResourceUtil.java:182)
at org.jetbrains.android.util.AndroidResourceUtil.findResourceFields(AndroidResourceUtil.java:168)
at org.jetbrains.android.AndroidGotoRelatedProvider.collectRelatedJavaFiles(AndroidGotoRelatedProvider.java:182)
at org.jetbrains.android.AndroidGotoRelatedProvider.getLazyItemsForXmlFile(AndroidGotoRelatedProvider.java:112)
at org.jetbrains.android.AndroidLineMarkerProvider.getMarkerInfo(AndroidLineMarkerProvider.java:91)
at org.jetbrains.android.AndroidLineMarkerProvider.doGetLineMarkerInfo(AndroidLineMarkerProvider.java:52)
at org.jetbrains.android.AndroidLineMarkerProvider.collectSlowLineMarkers(AndroidLineMarkerProvider.java:37)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryProviders(LineMarkersPass.java:209)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.lambda$doCollectInformation$3(LineMarkersPass.java:111)
at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:96)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectInformation(LineMarkersPass.java:106)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:70)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:438)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1156)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:431)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:556)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:430)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:406)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:142)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:242)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:404)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:165)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
java.lang.IllegalArgumentException: Resource name cannot be empty.
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
at com.android.ide.common.res2.ResourceItem.<init>(ResourceItem.java:115)
at com.android.ide.common.res2.IdGeneratingResourceParser$IdResourceItem.<init>(IdGeneratingResourceParser.java:202)
at com.android.ide.common.res2.IdGeneratingResourceParser.<init>(IdGeneratingResourceParser.java:81)
at com.android.ide.common.res2.ResourceSet.createResourceFile(ResourceSet.java:456)
at com.android.ide.common.res2.ResourceSet.createFileAndItems(ResourceSet.java:111)
at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:257)
at com.android.ide.common.res2.ResourceSet.handleNewFile(ResourceSet.java:52)
at com.android.ide.common.res2.DataSet.loadFile(DataSet.java:275)
at com.android.tools.idea.res.ResourceFolderRepository$InitialScanState.loadFile(ResourceFolderRepository.java:325)
at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFile(ResourceFolderRepository.java:524)
at com.android.tools.idea.res.ResourceFolderRepository.scanFileResourceFolder(ResourceFolderRepository.java:477)
at com.android.tools.idea.res.ResourceFolderRepository.scanResFolder(ResourceFolderRepository.java:449)
at com.android.tools.idea.res.ResourceFolderRepository.scanRemainingFiles(ResourceFolderRepository.java:375)
at com.android.tools.idea.res.ResourceFolderRepository.<init>(ResourceFolderRepository.java:119)
at com.android.tools.idea.res.ResourceFolderRepository.create(ResourceFolderRepository.java:152)
at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:76)
at com.android.tools.idea.res.ResourceFolderRegistry.get(ResourceFolderRegistry.java:64)
at com.android.tools.idea.res.ModuleResourceRepository.create(ModuleResourceRepository.java:95)
at com.android.tools.idea.res.ResourceRepositories.lambda$getModuleResources$2(ResourceRepositories.java:98)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
at com.android.tools.idea.res.ResourceRepositories.getModuleResources(ResourceRepositories.java:95)
at com.android.tools.idea.res.ModuleResourceRepository.findModuleResources(ModuleResourceRepository.java:71)
at com.android.tools.idea.res.ModuleResourceRepository.getOrCreateInstance(ModuleResourceRepository.java:59)
at com.android.tools.idea.res.ProjectResourceRepository.computeRepositories(ProjectResourceRepository.java:81)
at com.android.tools.idea.res.ProjectResourceRepository.create(ProjectResourceRepository.java:73)
at com.android.tools.idea.res.ResourceRepositories.lambda$getProjectResources$1(ResourceRepositories.java:83)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
at com.android.tools.idea.res.ResourceRepositories.getProjectResources(ResourceRepositories.java:80)
at com.android.tools.idea.res.ProjectResourceRepository.findProjectResources(ProjectResourceRepository.java:63)
at com.android.tools.idea.res.ProjectResourceRepository.getOrCreateInstance(ProjectResourceRepository.java:51)
at com.android.tools.idea.res.AppResourceRepository.computeRepositories(AppResourceRepository.java:156)
at com.android.tools.idea.res.AppResourceRepository.create(AppResourceRepository.java:123)
at com.android.tools.idea.res.ResourceRepositories.lambda$getAppResources$0(ResourceRepositories.java:68)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:942)
at com.android.tools.idea.res.ResourceRepositories.getAppResources(ResourceRepositories.java:65)
at com.android.tools.idea.res.AppResourceRepository.findAppResources(AppResourceRepository.java:117)
at com.android.tools.idea.res.AppResourceRepository.getOrCreateInstance(AppResourceRepository.java:99)
at org.jetbrains.android.resourceManagers.LocalResourceManager.getResourceNames(LocalResourceManager.java:261)
at org.jetbrains.android.resourceManagers.ResourceManager.getResourceNames(ResourceManager.java:349)
at org.jetbrains.android.augment.ResourceTypeClassBase.buildResourceFields(ResourceTypeClassBase.java:40)
at org.jetbrains.android.augment.ResourceTypeClass.buildLocalResourceFields(ResourceTypeClass.java:30)
at org.jetbrains.android.augment.AndroidPsiAugmentProvider.getAugments(AndroidPsiAugmentProvider.java:107)
at com.intellij.psi.augment.PsiAugmentProvider.lambda$collectAugments$0(PsiAugmentProvider.java:93)
at com.intellij.psi.augment.PsiAugmentProvider.forEach(PsiAugmentProvider.java:137)
at com.intellij.psi.augment.PsiAugmentProvider.collectAugments(PsiAugmentProvider.java:92)
at com.intellij.psi.impl.source.ClassInnerStuffCache.getAllFields(ClassInnerStuffCache.java:125)
at com.intellij.psi.impl.source.ClassInnerStuffCache.lambda$getFields$1(ClassInnerStuffCache.java:60)
at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:141)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:137)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:127)
at com.intellij.psi.impl.source.ClassInnerStuffCache.getFields(ClassInnerStuffCache.java:59)
at com.intellij.psi.impl.source.ClassInnerStuffCache.getFieldsMap(ClassInnerStuffCache.java:145)
at com.intellij.psi.impl.source.ClassInnerStuffCache.lambda$findFieldByName$4(ClassInnerStuffCache.java:82)
at com.intellij.psi.util.CachedValuesManager.lambda$getCachedValue$0(CachedValuesManager.java:141)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:137)
at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:127)
at com.intellij.psi.impl.source.ClassInnerStuffCache.findFieldByName(ClassInnerStuffCache.java:80)
at com.intellij.psi.impl.source.PsiClassImpl.findFieldByName(PsiClassImpl.java:362)
at org.jetbrains.android.util.AndroidResourceUtil.findResourceFieldsFromClass(AndroidResourceUtil.java:195)
at org.jetbrains.android.util.AndroidResourceUtil.findResourceFields(AndroidResourceUtil.java:182)
at org.jetbrains.android.util.AndroidResourceUtil.findResourceFields(AndroidResourceUtil.java:168)
at org.jetbrains.android.AndroidGotoRelatedProvider.collectRelatedJavaFiles(AndroidGotoRelatedProvider.java:182)
at org.jetbrains.android.AndroidGotoRelatedProvider.getLazyItemsForXmlFile(AndroidGotoRelatedProvider.java:112)
at org.jetbrains.android.AndroidLineMarkerProvider.getMarkerInfo(AndroidLineMarkerProvider.java:91)
at org.jetbrains.android.AndroidLineMarkerProvider.doGetLineMarkerInfo(AndroidLineMarkerProvider.java:52)
at org.jetbrains.android.AndroidLineMarkerProvider.collectSlowLineMarkers(AndroidLineMarkerProvider.java:37)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.queryProviders(LineMarkersPass.java:209)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.lambda$doCollectInformation$3(LineMarkersPass.java:111)
at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:96)
at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectInformation(LineMarkersPass.java:106)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:70)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:438)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1156)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:431)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:556)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:430)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:406)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:142)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:242)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:404)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:165)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Actualización: Todavía no he encontrado una solución, pero un compañero de trabajo que trabaja en otro proyecto (desde el cual bifurqué mi proyecto) acaba de sucederle lo mismo. Esto me lleva a pensar que esto puede ser específico del proyecto. Sin embargo, ninguno de los rastros de error muestra nada en nuestro proyecto. Esto, obviamente, hace que sea difícil de diagnosticar.
tal vez puedas intentarlo así. ve a la configuración en AndroidStudio. enter image description here
luego haz clic en ok.
Este error puede ocurrir cuando actualiza a Android Studio 3.0. No afecta su capacidad para crear un proyecto, pero el error no le permite ver visualmente sus archivos de diseño xml. También obtendrá el error al enviar archivos a GIT, pero aún puede confirmar y presionar.
Lo que encontré en uno de mis proyectos es que un archivo se agregó a la carpeta "menú" automáticamente con la actualización de Android Studio, y el archivo no tenía nombre. Fue nombrado simplemente ".xml". Todo lo que necesita hacer es eliminar el archivo y limpiar su proyecto, permitiendo una nueva compilación del proyecto. Eso debería encargarse del problema.