Error:Android Source Generator: IndexOutOfBoundsException after PC crash - android

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

Related

Android Studio build error on NTFS partition

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.

Android Studio 3.2 sync failed after update

I updated from Android Studio 3.1.4 to 3.2. Now sync fails with the error message
Sync finish event has not been received
How can this be fixed? Invalidate Caches/Restart did not help.
The ida log shows the following warning:
java.lang.NoClassDefFoundError: org/gradle/wrapper/WrapperConfiguration
at org.jetbrains.plugins.gradle.util.GradleUtil.getWrapperConfiguration(GradleUtil.java:92)
at org.jetbrains.plugins.gradle.service.GradleInstallationManager.getGradleHome(GradleInstallationManager.java:208)
at org.jetbrains.plugins.gradle.service.GradleInstallationManager.doGetGradleHome(GradleInstallationManager.java:194)
at org.jetbrains.plugins.gradle.service.GradleInstallationManager.getGradleHome(GradleInstallationManager.java:129)
at org.jetbrains.plugins.gradle.GradleManager.lambda$getExecutionSettingsProvider$2(GradleManager.java:150)
at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.getExecutionSettings(ExternalSystemApiUtil.java:732)
at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager.doCreateFacade(ExternalSystemFacadeManager.java:201)
at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager.doGetFacade(ExternalSystemFacadeManager.java:177)
at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager.doInvoke(ExternalSystemFacadeManager.java:132)
at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager$MyHandler.invoke(ExternalSystemFacadeManager.java:269)
at com.sun.proxy.$Proxy148.getResolver(Unknown Source)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:84)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:163)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:149)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:550)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:647)
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)
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.WrapperConfiguration PluginClassLoader[org.jetbrains.plugins.gradle, 181.5540.7.32.5014246] com.intellij.ide.plugins.cl.PluginClassLoader#5f6fe2bb
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:63)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
The only solution I found was to remove Android Studio and reinstall Android Studio 3.2 from scratch.
EDIT
The problem might be different from OP but this is also a new issue in AS 3.2 which gives you Gradle sync error
I had Gradle sync error for the last couple of days after I updated to AS 3.2 and in my case, the problem was one of my library modules contain the following in Manifest.xml
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="27" />
and the solution was to remove 'uses-sdk' (in AndroidManifest.xml file) in ALL the modules in your project.
Try to look into the log of the IDE, for my case it was a flutter plugin causing the issue..
You can navigate to the logs by clicking on show log in the gradle try again strip at the top.
or
go to
~/username/Library/Logs/AndroidStudio3.5/
and read the idea.log file.
java.lang.NoClassDefFoundError:
org/gradle/wrapper/WrapperConfiguration
It seems like WrapperConfiguration class couldn't be found. Try these commands:
brew install gradle
gradle wrapper
The second line will install wrapper class. And then,
gradlew clean

Android Source Generator: Error: Can't find bundle for base name messages.AndroidJpsBundle

I previously was using Android Studio v2.3 to Make Module and it was ok. Now I changed to Android Studio v3.0, when I trying to Make Module, it shows the error below:
Error:Android Source Generator: Error: Can't find bundle for base name messages.AndroidJpsBundle, locale en_US
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)
I ran into the same issue and this worked for me so let me know how it goes.
Right click on your project and open up Module Settings
Click facets.
Add Android-Gradle and apply.
Close and reopen project and rebuild.
backup AndroidStudio3.0\plugins\android\lib\jps\*.jar
Copy AndroidStudio2.3.3\plugins\android\lib\jps\*.jar to
AndroidStudio3.0\plugins\android\lib\jps\*.jar
It looks like I did not open the correct project directory in Android Studio. I have a Grande project, but when opened [Project Folder] -> [Android] -> [App] as an existing project in Android Studio, it solved the problem for me!
When you open as existing project the [Project Folder] only in Android Studio and try to compile and generate the APK, it will show this error above: Error:Android Source Generator....
So, please ensure you import the correct directory of your Android Project ;-)

AVD not getting started in Android Studio. IDE internal error occured

I imported one of my android project and tried to run it in a simulator. A soon i clicked the run button and ADB was about to initialize i saw a red balloon" An Internal error occured". Logs show the following error
null
java.lang.NullPointerException
at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1514)
at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1478)
at com.android.sdklib.internal.avd.AvdManager.<init>(AvdManager.java:373)
at com.android.sdklib.internal.avd.AvdManager.getInstance(AvdManager.java:411)
at com.android.tools.idea.avdmanager.AvdManagerConnection.initIfNecessary(AvdManagerConnection.java:159)
at com.android.tools.idea.avdmanager.AvdManagerConnection.getAvds(AvdManagerConnection.java:255)
at com.android.tools.idea.run.editor.DevicePicker.lambda$refreshAvds$496(DevicePicker.java:186)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
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)
I tried alot with the solutions mentioned in other problems but all in vain
Any solution for this please
Attached is image also
I just solved this problem by delete all files in ~/.android/avd
but my avd still can't run properly.

Android Studio drawable is missing

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.

Categories

Resources