I'm using Android Studio 2.2 Preview 5.
When I try to render a layout, it displays following error:
Rendering Problems
java.nio.file.InvalidPathException: Illegal char <:> at index 8: #android:drawable/ic_menu_send
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
at com.android.ide.common.res2.ResourceItem.parseFileName(ResourceItem.java:585)
at com.android.ide.common.res2.ResourceItem.parseXmlToResourceValue(ResourceItem.java:405)
at com.android.ide.common.res2.ResourceItem.getResourceValue(ResourceItem.java:240)
at com.android.ide.common.res2.AbstractResourceRepository.getConfiguredResources(AbstractResourceRepository.java:393)
at com.android.ide.common.res2.AbstractResourceRepository.getConfiguredResources(AbstractResourceRepository.java:349)
at com.android.tools.idea.configurations.ResourceResolverCache$1.compute(ResourceResolverCache.java:166)
at com.android.tools.idea.configurations.ResourceResolverCache$1.compute(ResourceResolverCache.java:163)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.configurations.ResourceResolverCache.getResourceResolver(ResourceResolverCache.java:163)
at com.android.tools.idea.configurations.Configuration.getResourceResolver(Configuration.java:1212)
at com.android.tools.idea.rendering.RenderTask.getResourceResolver(RenderTask.java:198)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:425)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$52(RenderTask.java:659)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
So I looked in the folder for android-19 and android-23:
sdk/platforms/android-**/data/res/drawable
But in neither of these is the file ic_menu_send.xml
My xml file contained a src="#android:drawable/ic_menu_send" once, but I removed it and chose another icon.
Then there was a ic_menu_send.xml (v21) in my res folder, so I deleted it because I didn't need it anymore.
If that was the reason, could someone please send me the ic_menu_send.xml file for the 2 versions or tell me how I can redownload all drawables?
I don't think what you deleted was an xml file, but an image file. So here you go:
http://i.stack.imgur.com/ZBWSc.png
Just save it as 'ic_menu_send.png' and put it back in that folder.
Related
I'm having problems building apps on Android Studio. Things work fine when the project is on my ext4 partition, but when I created a new one on my NTFS, I encountered this:
Argument for #NotNull parameter 'message' of com/android/tools/idea/gradle/project/sync/GradleSyncState.syncFailed must not be null
java.lang.IllegalArgumentException: Argument for #NotNull parameter 'message' of com/android/tools/idea/gradle/project/sync/GradleSyncState.syncFailed must not be null
at com.android.tools.idea.gradle.project.sync.GradleSyncState.$$$reportNull$$$0(GradleSyncState.java)
at com.android.tools.idea.gradle.project.sync.GradleSyncState.syncFailed(GradleSyncState.java)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.doPopulateProject(IdeaSyncPopulateProjectTask.java:135)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.populate(IdeaSyncPopulateProjectTask.java:97)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.access$000(IdeaSyncPopulateProjectTask.java:39)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask$1.run(IdeaSyncPopulateProjectTask.java:86)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
The error disappeared when I restarted Android Studio, but after that I still cannot run my app (the project structure in the sidebar is not displayed properly).
I'm using Android Studio 3.2 on Ubuntu 18.04.1.
I figured it out. (By mistake, to be honest...)
Let's say you have an NTFS partition mount at /mnt/ntfs, and your project is at /mnt/ntfs/projects/project.
Your home partition (ext4) is mounted at /home, your home directory is /home/user and you have a symbolic link at /home/user/projects that points to /mnt/ntfs/projects.
The reason I (and hopefully you too) have encountered this error is that when using Android Studio's "Open Project..." option, I provided the symbolic link (/home/user/projects/project). When trying to provide the real path (/mnt/ntfs/projects/project) the gradle sync succeeded.
So to fix this for now, simply provide the real path. However, this should probably be addressed by IntelliJ or the developers of Gradle.
Anybody, please help me I cannot run the Android apps because of the following errors.
java.util.MissingResourceException: Can't find bundle for base name
messages.AndroidJpsBundle, locale en_US at
java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:773) at
org.jetbrains.jps.android.AndroidJpsBundle.getBundle(AndroidJpsBundle.java:22)
at
org.jetbrains.jps.android.AndroidJpsBundle.message(AndroidJpsBundle.java:32)
at
org.jetbrains.jps.android.AndroidSourceGeneratingBuilder.runAaptCompiler(AndroidSourceGeneratingBuilder.java:971)
at
org.jetbrains.jps.android.AndroidSourceGeneratingBuilder.doBuild(AndroidSourceGeneratingBuilder.java:210)
at
org.jetbrains.jps.android.AndroidSourceGeneratingBuilder.build(AndroidSourceGeneratingBuilder.java:114)
at
org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1263)
at
org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:940)
at
org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1012)
at
org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:903)
at
org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:736)
at
org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:384)
at
org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:192)
at
org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
at
org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:295)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at
org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:236)
at
org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) [下午5:49, 2017年10月30日] +852
9034 6076: Information:30/10/2017, 5:10 PM - Compilation completed
with 1 error and 0 warnings in 5s 426ms
Error: Can't find bundle for base name messages.AndroidJpsBundle, locale en_US
Make sure the root directory contains the AndroidManifest.xml file. Also, the root directory must contain either the .project and .classpath files or the res/ and src/ directories.
To reload a project do Import as a Project:
Start Android Studio and close any open Android Studio projects.
From the Android Studio menu click File > New > Import Project.
Alternatively, from the Welcome screen, click Import project.
Select the project folder with the AndroidManifest.xml file and click Ok.
See section Import as a Project.
After project imported
I have the same issue but with even something more strange: the missing locale resource is en_NL which should never exist and I have no idea where this is coming from.
The language settings are en_GB and en_US.
In the Android Studio 3.0 the resources.asrc is present and seems OK.
Update:
I managed to get rid of this error. The project I'm working on is a Cordova project.
I opened the generated .apk file in Studio. That caused to error to appear.
When opening .../platforms/android in Studio everything works fine.
Perhaps not related: I also went back to version 2.3.3 of Studio. I'll keep you updated for this last point.
Update:
Studio 3.0 works also.
My PC has crashed occasionally, and after restart I got this, and can't run my project. What do to, who knows?
UPDATED for moderator: this is definitely Android Studio bug, so appropriate tag is important for whose who will search the same. The cause is in Android Studio's .idea file, I assume for now.
Error:Android Source Generator: Error:
java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException at
java.io.ByteArrayInputStream.read(ByteArrayInputStream.java:180) at
com.intellij.util.io.CompressedAppendableFile$SegmentedChunkInputStream.read(CompressedAppendableFile.java:541)
at java.io.DataInputStream.readFully(DataInputStream.java:195) at
com.intellij.util.io.PersistentHashMapValueStorage.readBytes(PersistentHashMapValueStorage.java:401)
at
com.intellij.util.io.PersistentHashMap.doGet(PersistentHashMap.java:518)
at
com.intellij.util.io.PersistentHashMap.get(PersistentHashMap.java:472)
at
org.jetbrains.jps.incremental.storage.AbstractStateStorage.getState(AbstractStateStorage.java:117)
at
org.jetbrains.jps.android.AndroidSourceGeneratingBuilder.runAaptCompiler(AndroidSourceGeneratingBuilder.java:913)
at
org.jetbrains.jps.android.AndroidSourceGeneratingBuilder.doBuild(AndroidSourceGeneratingBuilder.java:210)
at
org.jetbrains.jps.android.AndroidSourceGeneratingBuilder.build(AndroidSourceGeneratingBuilder.java:114)
at
org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1237)
at
org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:911)
at
org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:983)
at
org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:870)
at
org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:696)
at
org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:387)
at
org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:194)
at
org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
at
org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:294)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at
org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:232)
at
org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:44)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
The answer is: delete .idea folder
Or better move it first to somewhere, on the case you forget something from configuration.
Android Studio 2.3.3
After updating from Android studio 2.2 preview 4 to 5, Design and Preview tabs stopped to show previews.
They don't show anything, only the error (described below) and a tip "Try to refresh the layout".
Refreshing and choosing different options in a top bar (API, device orientation) doesn't help.
Was trying File -> Invalidate Caches/Restart. Doesn't help either.
Any suggestions?
java.nio.file.InvalidPathException: Illegal char <:> at index 8: #android:drawable/ic_menu_send
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
at com.android.ide.common.res2.ResourceItem.parseFileName(ResourceItem.java:585)
at com.android.ide.common.res2.ResourceItem.parseXmlToResourceValue(ResourceItem.java:405)
at com.android.ide.common.res2.ResourceItem.getResourceValue(ResourceItem.java:240)
at com.android.ide.common.res2.AbstractResourceRepository.getConfiguredResources(AbstractResourceRepository.java:393)
at com.android.ide.common.res2.AbstractResourceRepository.getConfiguredResources(AbstractResourceRepository.java:349)
at com.android.tools.idea.configurations.ResourceResolverCache$1.compute(ResourceResolverCache.java:166)
at com.android.tools.idea.configurations.ResourceResolverCache$1.compute(ResourceResolverCache.java:163)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.configurations.ResourceResolverCache.getResourceResolver(ResourceResolverCache.java:163)
at com.android.tools.idea.configurations.Configuration.getResourceResolver(Configuration.java:1212)
at com.android.tools.idea.rendering.RenderTask.getResourceResolver(RenderTask.java:198)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:425)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$52(RenderTask.java:659)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
UPD1: Seem to be an issue.
In your activity.xml file there must be a line as xmlns:app="". Delete it.
There is an error in xml file check that no
android: or xmlns:app=""
Fixed in Android studio 2.2 (Canary) Preview 6 (also see issue).
I have recently updated my Android Studio to v 2.2 Preview 5. and as I tried to run my one of my project I am getting 2 Errors.
java.nio.file.InvalidPathException after Update (As I preview the layout.)
Error:Execution failed for task ':app:mergeDebugResources'.> D:\Work\petrichors\projects\Eguide\app\src\main\res\layout-xlarge-xhdpi-land: Error: Invalid resource directory name.
However the project was running fine on previous version I had.
Log:
java.nio.file.InvalidPathException: Illegal char <:> at index 8: #android:drawable/ic_menu_slideshow
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
at com.android.ide.common.res2.ResourceItem.parseFileName(ResourceItem.java:585)
at com.android.ide.common.res2.ResourceItem.parseXmlToResourceValue(ResourceItem.java:405)
at com.android.ide.common.res2.ResourceItem.getResourceValue(ResourceItem.java:240)
at com.android.ide.common.res2.AbstractResourceRepository.getConfiguredResources(AbstractResourceRepository.java:393)
at com.android.ide.common.res2.AbstractResourceRepository.getConfiguredResources(AbstractResourceRepository.java:349)
at com.android.tools.idea.configurations.ResourceResolverCache$1.compute(ResourceResolverCache.java:166)
at com.android.tools.idea.configurations.ResourceResolverCache$1.compute(ResourceResolverCache.java:163)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.configurations.ResourceResolverCache.getResourceResolver(ResourceResolverCache.java:163)
at com.android.tools.idea.configurations.Configuration.getResourceResolver(Configuration.java:1212)
at com.android.tools.idea.rendering.RenderTask.getResourceResolver(RenderTask.java:198)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:425)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$52(RenderTask.java:659)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
However the project was running fine on previous version I had.
That directory has been invalid for several years. Most likely, the tools and Android just ignored it, or did not honor all of its qualifiers, and now the build tools are validating the directory names.
Change layout-xlarge-xhdpi-land to layout-xlarge-land-xhdpi. Qualifier rules have to appear in the directory name (left to right) in the order that they appear in "Table 2" (top to bottom).
Or, better yet, remove -xhdpi outright. Having a density qualifier in anything other than a drawable or mipmap resource directory is a code smell. It should not be necessary and may not be doing what you think it should be doing anyway.
I had the same InvalidPathException problem this morning, also after updated to v2.2 preview 5. I solved it by removing leading/trailing spaces and line-break on the concerned XML declaration.
Check if there is a ':' which should not be here.
It seems Android Studio is a bit more sensitive to XML values.