Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: - android

I updated Android Studio to version 3.6 and after running my projects i got this error saying "Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
"
2020-02-28 14:44:25,568 [ 542460] WARN - e.project.sync.GradleSyncState - Gradle sync failed: Cause: invalid type code: 85
Consult IDE log for more details (Help | Show Log) (1 s 245 ms)
2020-02-28 14:44:25,568 [ 542460] WARN - e.project.sync.GradleSyncState -
java.lang.RuntimeException:
at com.android.tools.idea.gradle.project.sync.idea.ProjectSetUpTask.onFailure(ProjectSetUpTask.java:120)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.executeImpl(ExternalSystemUtil.java:576)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.lambda$execute$0(ExternalSystemUtil.java:388)
at com.intellij.openapi.project.DumbServiceImpl.suspendIndexingAndRun(DumbServiceImpl.java:149)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:388)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:649)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:894)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:408)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2020-02-28 14:44:25,649 [ 542541] INFO - roid.tools.ndk.GradleWorkspace - Updating model took 0.039s
2020-02-28 14:44:25,895 [ 542787] INFO - ge.ExternalProjectsDataStorage - Save external projects data in 5 ms
2020-02-28 14:44:26,052 [ 542944] INFO - rationStore.ComponentStoreImpl - Saving Project 'C:\Users\himan\AndroidStudioProjects\Charging' ChargingKotlin2JvmCompilerArguments took 18 ms
2020-02-28 14:44:26,078 [ 542970] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 213 ms
2020-02-28 14:44:30,859 [ 547751] INFO - ide.actions.ShowFilePathAction -
Exit code 1

After trying whole day to solve this problem i got this solution
i had jdk13 and after updating Android studio to 3.6.0, and with that groovy's latest version was also updated, on some websites it showed that groovy had some issues with jdk 9+ in latest version.
So i downgraded jdk from jdk13 to jdk8 and problem got solved

Just my 2 cents here but I get this error when I put an apostrophe in my project name.

It happens if you put some special characters in the Project Name while creating the project.

Just try removing any special characters(if any) from your project name.
While making a project, if you put any special characters in your Project name, you get this kind of error.
You won't be having a res folder and the gradle files would be misplaced.

I accidentally tapped codecleanup and then the errors got started. what i did was copy paste project gradle and gradle properties from some similar projects and then it was good to go.
I don't say it is perfect solution but it worked for me and may work for others as well

Related

Installing an app from Android Studio has timed out

Since we migrated to modules we started experiencing a time out when installing the application for the second time. It only happens if we run the app for the second time. If we clear the project (Build->Clean Project) it launches ok, but the next time we try to run, it times out.
I have looked at the Android Studio logs and found an error that is thrown when launching the app but I am not sure what could go wrong and how to interpret these logs. Here is the snapshot of the logs:
2021-01-19 12:26:15,790 [413000061] INFO - ools.idea.run.tasks.DeployTask - Installing application: *****
2021-01-19 12:26:15,792 [413000063] ERROR - intellij.openapi.progress.Task - entry
java.lang.NullPointerException: entry
at java.util.zip.ZipFile.getInputStream(ZipFile.java:361)
at com.android.tools.deployer.ApkParser.getApkDetails(ApkParser.java:88)
at com.android.tools.deployer.ApkParser.parse(ApkParser.java:107)
at com.android.tools.deployer.ApkParser.parsePaths(ApkParser.java:76)
at com.android.tools.deployer.ApkInstaller.deltaInstall(ApkInstaller.java:244)
at com.android.tools.deployer.ApkInstaller.install(ApkInstaller.java:91)
at com.android.tools.deployer.Deployer.install(Deployer.java:145)
at com.android.tools.idea.run.tasks.DeployTask.perform(DeployTask.java:119)
at com.android.tools.idea.run.tasks.AbstractDeployTask.run(AbstractDeployTask.java:119)
at com.android.tools.idea.run.LaunchTaskRunner.run(LaunchTaskRunner.java:191)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:932)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:434)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$null$3(ProgressRunner.java:233)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:166)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:153)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:233)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2021-01-19 12:26:15,798 [413000069] ERROR - intellij.openapi.progress.Task - Android Studio 4.1.1 Build #AI-201.8743.12.41.6953283
2021-01-19 12:26:15,799 [413000070] ERROR - intellij.openapi.progress.Task - JDK: 1.8.0_242-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o
2021-01-19 12:26:15,799 [413000070] ERROR - intellij.openapi.progress.Task - OS: Windows 10
2021-01-19 12:26:15,799 [413000070] ERROR - intellij.openapi.progress.Task - Last Action: Run
2021-01-19 12:26:46,303 [413030574] INFO - j.ide.actions.RevealFileAction - Exit code 1
Please, help.
The issue was related to different versions of Android Studio and Android Gradle Plugin. When I had updated the Android Gradle Plugin version to the last available version the issue was gone. For more info see the posted issue in issue tracker.

Realm 5.15.0 and up to latest version (6.0.2), fails gradle sync

We are using Realm as our DB framework for Android. Current working version is 5.14.0. Yesterday we tried upgrading to 6.0.2 and gradle sync failed. I then pushed back the versions and saw that starting from 5.15.0 Realm causes gradle sync to fail with errors:
ERROR: Failed to resolve: io.realm:realm-android-library:5.15.0
ERROR: Failed to resolve: io.realm:realm-annotations:5.15.0
and a few other dependencies failing with the same exact error (but these might be affected by the first fail)
When I tried version 5.14 again, I got no errors and every thing was fine.
I checked the gradle build log and I could see this line appearing MANY times:
WARN - un.AndroidRunConfigurationBase - Can't get application ID: Android module missing
And a few like these:
WARN - roid.tools.ndk.GradleWorkspace - NDK support for project 'project.name' is disabled because the project doesn't contain any valid native configurations.
and some:
INFO - ty.VersionCompatibilityChecker - Failed to find version reader for component 'android-gradle-experimental-plugin'
one of these:
INFO - pl.ProjectRootManagerComponent - project roots have changed
and eventually:
INFO - e.project.sync.GradleSyncState - Gradle sync failed (50 s 766 ms)
It looks like the sync starts SYNC_TASK_CREATED, some libraries download and then SETUP_STARTED. It then fails almost right away.
Does anyone have any idea what is going on here and maybe possible reasons why this might fail? I can add any extra info you may need.
Thanks.
EDIT:
I just ran ./gradlew check --stacktrace to get some more info on what is causing the issue and I get this:
Could not determine the dependencies of task ':app-name:testProdReleaseUnitTest'.
> Could not resolve all task dependencies for configuration ':app-name:prodReleaseUnitTestRuntimeClasspath'.
> Could not find io.realm:realm-android-library:5.15.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://dl.google.com/dl/android/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- https://jitpack.io/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://jitpack.io/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- https://maven.fabric.io/public/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://maven.fabric.io/public/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- https://github.com/uPhyca/stetho-realm/raw/master/maven-repo/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://github.com/uPhyca/stetho-realm/raw/master/maven-repo/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- http://maven.batch.com/release/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- http://maven.batch.com/release/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- https://repo.maven.apache.org/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://repo.maven.apache.org/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find io.realm:realm-android-library:5.15.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://dl.google.com/dl/android/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- https://jitpack.io/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://jitpack.io/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- https://maven.fabric.io/public/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://maven.fabric.io/public/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- https://github.com/uPhyca/stetho-realm/raw/master/maven-repo/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://github.com/uPhyca/stetho-realm/raw/master/maven-repo/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- http://maven.batch.com/release/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- http://maven.batch.com/release/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
- https://repo.maven.apache.org/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
- https://repo.maven.apache.org/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
Ok that was stupid.
I really should give the error messages more credit...
I added
mavenLocal()
jcenter()
to
allprojects {
repositories {
}
in the root build.gradle file and now it found the Realm repo. Hehe.
Thanks to all the viewers of this question.

Android Studio 3.0 Kotlin not working properly

I have recently installed Android Studio 3.0 and started a new project using Kotlin. The kotlin plugin with highlighting and code completion have been working fine since I started the project. However, a couple of days ago I closed Android Studio for the first time since I started this project, and now when I reopened it, code completion and highlighting have stopped working and Android Studio shows me the following exception:
2017-11-05 19:38:03,424 [ thread 19] ERROR - on.CompletionProgressIndicator - Resolver for 'completion/highlighting in org.jetbrains.kotlin.idea.caches.resolve.NotUnderContentRootModuleInfo#3a2816ac for files GameMainActivity.kt for platform JVM' does not know how to resolve ModuleProductionSourceInfo(module=Module: 'app')
java.lang.AssertionError: Resolver for 'completion/highlighting in org.jetbrains.kotlin.idea.caches.resolve.NotUnderContentRootModuleInfo#3a2816ac for files GameMainActivity.kt for platform JVM' does not know how to resolve ModuleProductionSourceInfo(module=Module: 'app')
at org.jetbrains.kotlin.analyzer.ResolverForProjectImpl.descriptorForModule(AnalyzerFacade.kt:168)
at org.jetbrains.kotlin.analyzer.ResolverForProjectImpl.descriptorForModule(AnalyzerFacade.kt:77)
at org.jetbrains.kotlin.analyzer.ResolverForProject.resolverForModule(AnalyzerFacade.kt:56)
at org.jetbrains.kotlin.idea.caches.resolve.ProjectResolutionFacade.resolverForModuleInfo(ProjectResolutionFacade.kt:73)
at org.jetbrains.kotlin.idea.caches.resolve.ResolutionFacadeImpl.tryGetFrontendService(ResolutionFacadeImpl.kt:87)
at org.jetbrains.kotlin.idea.caches.resolve.JavaResolutionUtils.getJavaDescriptorResolver(JavaResolveExtension.kt:109)
at org.jetbrains.kotlin.idea.caches.resolve.JavaResolutionUtils.getJavaClassDescriptor(JavaResolveExtension.kt:55)
at org.jetbrains.kotlin.idea.caches.resolve.JavaResolutionUtils.resolveToDescriptor(JavaResolveExtension.kt:103)
at org.jetbrains.kotlin.idea.caches.resolve.JavaResolutionUtils.resolveToDescriptor$default(JavaResolveExtension.kt:95)
at org.jetbrains.kotlin.idea.completion.BasicCompletionSession$ALL$1$completeNonImported$6.invoke(BasicCompletionSession.kt:379)
at org.jetbrains.kotlin.idea.completion.BasicCompletionSession$ALL$1$completeNonImported$6.invoke(BasicCompletionSession.kt:182)
at org.jetbrains.kotlin.idea.completion.AllClassesCompletion$addAdaptedJavaCompletion$1.consume(AllClassesCompletion.kt:100)
at org.jetbrains.kotlin.idea.completion.AllClassesCompletion$addAdaptedJavaCompletion$1.consume(AllClassesCompletion.kt:41)
at com.intellij.codeInsight.completion.LimitedAccessibleClassPreprocessor.process(LimitedAccessibleClassPreprocessor.java:80)
at com.intellij.codeInsight.completion.LimitedAccessibleClassPreprocessor.process(LimitedAccessibleClassPreprocessor.java:32)
at com.intellij.psi.impl.search.AllClassesSearchExecutor.processClassesByNames(AllClassesSearchExecutor.java:84)
at com.intellij.codeInsight.completion.AllClassesGetter.processJavaClasses(AllClassesGetter.java:157)
at com.intellij.codeInsight.completion.AllClassesGetter.processJavaClasses(AllClassesGetter.java:143)
at org.jetbrains.kotlin.idea.completion.AllClassesCompletion.addAdaptedJavaCompletion(AllClassesCompletion.kt:89)
at org.jetbrains.kotlin.idea.completion.AllClassesCompletion.collect(AllClassesCompletion.kt:72)
at org.jetbrains.kotlin.idea.completion.BasicCompletionSession$ALL$1.completeNonImported(BasicCompletionSession.kt:379)
at org.jetbrains.kotlin.idea.completion.BasicCompletionSession$ALL$1.access$completeNonImported(BasicCompletionSession.kt:182)
at org.jetbrains.kotlin.idea.completion.BasicCompletionSession$ALL$1$doComplete$4.invoke(BasicCompletionSession.kt:304)
at org.jetbrains.kotlin.idea.completion.BasicCompletionSession$ALL$1$doComplete$4.invoke(BasicCompletionSession.kt:182)
at org.jetbrains.kotlin.idea.completion.CompletionSession.withContextVariablesProvider(CompletionSession.kt:385)
at org.jetbrains.kotlin.idea.completion.BasicCompletionSession$ALL$1.doComplete(BasicCompletionSession.kt:274)
at org.jetbrains.kotlin.idea.completion.BasicCompletionSession.doComplete(BasicCompletionSession.kt:154)
at org.jetbrains.kotlin.idea.completion.CompletionSession._complete(CompletionSession.kt:233)
at org.jetbrains.kotlin.idea.completion.CompletionSession.complete(CompletionSession.kt:208)
at org.jetbrains.kotlin.idea.completion.KotlinCompletionContributor.doComplete(KotlinCompletionContributor.kt:301)
at org.jetbrains.kotlin.idea.completion.KotlinCompletionContributor.doComplete$default(KotlinCompletionContributor.kt:262)
at org.jetbrains.kotlin.idea.completion.KotlinCompletionContributor.performCompletion(KotlinCompletionContributor.kt:255)
at org.jetbrains.kotlin.idea.completion.KotlinCompletionContributor.access$performCompletion(KotlinCompletionContributor.kt:47)
at org.jetbrains.kotlin.idea.completion.KotlinCompletionContributor$provider$1.addCompletions(KotlinCompletionContributor.kt:58)
at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:151)
at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:138)
at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:131)
at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$2.addCompletions(LiveTemplateCompletionContributor.java:88)
at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:151)
at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:110)
at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:831)
at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$600(CompletionProgressIndicator.java:93)
at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:813)
at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:108)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:931)
at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$1(CompletionThreading.java:105)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:176)
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.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$2(CompletionThreading.java:103)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:334)
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)
2017-11-05 19:38:03,425 [ thread 19] ERROR - on.CompletionProgressIndicator - Android Studio 3.0 Build #AI-171.4408382
2017-11-05 19:38:03,425 [ thread 19] ERROR - on.CompletionProgressIndicator - JDK: 1.8.0_152-release
2017-11-05 19:38:03,425 [ thread 19] ERROR - on.CompletionProgressIndicator - VM: OpenJDK 64-Bit Server VM
2017-11-05 19:38:03,425 [ thread 19] ERROR - on.CompletionProgressIndicator - Vendor: JetBrains s.r.o
2017-11-05 19:38:03,425 [ thread 19] ERROR - on.CompletionProgressIndicator - OS: Mac OS X
2017-11-05 19:38:03,425 [ thread 19] ERROR - on.CompletionProgressIndicator - Last Action: EditorBackSpace
2017-11-05 19:38:04,922 [ thread 19] ERROR - on.CompletionProgressIndicator - Resolver for 'completion/highlighting in org.jetbrains.kotlin.idea.caches.resolve.NotUnderContentRootModuleInfo#3a2816ac for files GameMainActivity.kt for platform JVM' does not know how to resolve ModuleProductionSourceInfo(module=Module: 'app')
I have raised a bug already which seems has been sent to JetBrains from within Android Studio, however I wonder if anyone else has gone through this and has found a workaround that I can try on my end to get over this bug momentarily until it is resolved by JetBrains.
This bug you are reporting has been resolved almost a year ago and it was affecting an old version of the Kotlin plugin: https://youtrack.jetbrains.com/issue/KT-12264
Try invalidating the AS cache and restarting it (File -> Invalidate Caches / Restart -> Invalidate Caches and Restart).
The issue happened because I renamed app/src/main/java to app/src/main/kotlin (since Android Studio doesn't do this itself even though the project was setup to include kotlin support from scratch) and the latter was not marked as a source folder. Once it was marked as a source folder, the issue resolved immediately.

"Gradle project refresh failed" error just after install Studio 2.2.1 (no coding!)

I will really appreciate any help or insight here.
I need to config Android Studio (2.2.1 latest) but it is being a pain! Just after to be installed, I use the wizard (new project) to create a totally blank "app" only using defaults.
Just after the app to be created, AS2 give me this: Gradle 'MyApplication' project refresh failed like in the following image:
It is VERY frustrating when you install a program, use all defaults to make something, and it gives an error just on open!
I tried to reinstall everything, even cleaning .java, .gradle, .androidXXX, tryed so many solutions here in the SoF, and still nothing. Same error since yesterday!
My specs:
Java 1.8 Oracle (with JDK, everything working in other programs)
Linux Mint 18
Android Studio 2.2.1
Gradle 2.14.1 (as i can see in android-studio/gradle/ folder)
Please, any help, idea, guessing or any else for this? Thanks in advance!
--edit--
Some logs that could be relevant:
2016-10-17 01:01:50,059 [ 67026] INFO - radle.project.ProjectSetUpTask - Process 'command '/home/sidney/bin/android-studio/jre/bin/java'' finished with non-zero exit value 2
Consult IDE log for more details (Help | Show Log)
2016-10-17 01:01:50,059 [ 67026] INFO - ls.idea.gradle.GradleSyncState - Sync with Gradle for project 'My Application' failed: Process 'command '/home/sidney/bin/android-studio/jre/bin/java'' finished with non-zero exit value 2
Consult IDE log for more details (Help | Show Log)
2016-10-17 01:01:50,176 [ 67143] WARN - roid.tools.ndk.GradleWorkspace - NDK support for project 'My Application' is disabled because the project doesn't contain any valid native configurations.
2016-10-17 01:01:50,444 [ 67411] INFO - #com.jetbrains.cidr.lang - Clearing symbols finished in 0 s.
2016-10-17 01:01:50,448 [ 67415] INFO - #com.jetbrains.cidr.lang - Loading symbols finished in 0 s.
2016-10-17 01:01:50,453 [ 67420] INFO - #com.jetbrains.cidr.lang - Building symbols finished in 0 s.
2016-10-17 01:01:50,454 [ 67421] INFO - #com.jetbrains.cidr.lang - Saving symbols finished in 0 s.
2016-10-17 01:02:59,434 [ 136401] WARN - ConfigurableExtensionPointUtil - ignore deprecated groupId: editor for id: editor.preferences.import
2016-10-17 01:03:25,793 [ 162760] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /home/sidney/bin/android-studio/jre
2016-10-17 01:03:25,794 [ 162761] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /home/sidney/bin/android-studio/jre
--edit--
Since AS Gradle Console won't let me type, I've installed gradle system-wide via apt-get and run gradle --debug on MyApplication root. The output can be seen here (too long to post here)
In the debug output, you can see
Instructing gradle to use java from /home/sidney/bin/android-studio/jre
Now, if you notice that path, that's the JRE, not the Oracle JDK. I'm honestly not sure why Android Studio ships with a buggy Java JRE, what version it is, why it's the default, or even recommended, but find the IDE settings for setting up the correct JDK.
Hopefully it'll run successfully after that.
It might take a while to build and download some dependencies the first time, but should be faster after that. If you don't plan on downloading many libraries to start out, you can enable Offline Mode to have it be quicker

Intellij Idea log GradleConnectionException: Could not execute build using Gradle installation while building

I use Intellij Idea 13.1.1 and I get GradleConnectionException while building:
Error:org.gradle.tooling.GradleConnectionException:
Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.:
Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.
I've seen similar question here and googled it. But it didn't help me.
In the end I found Idea's buld log and this is the exception with more details from there (sorry for very long log, but it's just for more detailed information):
2014-06-04 10:41:20,732 [ 0] INFO - jps.cmdline.JpsModelLoaderImpl - Loading model: project path = <PATH_TO_MY_PROJECT>, global options path = C:/Users/<USER_NAME>/.IdeaIC13/config/options
2014-06-04 10:41:21,404 [ 672] INFO - jps.cmdline.JpsModelLoaderImpl - Model loaded in 673 ms
2014-06-04 10:41:21,404 [ 672] INFO - jps.cmdline.JpsModelLoaderImpl - Project has 3 modules, 14 libraries
2014-06-04 10:41:21,643 [ 911] INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=688586752
2014-06-04 10:41:22,288 [ 1556] INFO - .incremental.IncProjectBuilder - Building project; isRebuild:false; isMake:true parallel compilation:false
2014-06-04 10:41:22,292 [ 1560] INFO - r.api.ClassFilesIndicesBuilder - class files data index disabled
2014-06-04 10:41:22,329 [ 1597] INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational
2014-06-04 10:41:22,456 [ 1724] INFO - der.AndroidGradleTargetBuilder - Using execution settings: BuilderExecutionSettings[embeddedGradleDaemonEnabled=false, buildMode=SOURCE_GEN, gradleDaemonMaxIdleTimeInMs=60000, gradleDaemonCommandLineOptions=[], gradleDaemonJvmOptions=[], gradleHomeDir=C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10, gradleServiceDir=null, javaHomeDir=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\jre\jre, offlineBuild=false, parallelBuild=false, projectDir=<PATH_TO_MY_PROJECT>, verboseLoggingEnabled=false, modulesToBuildNames=[<PROJECT_NAME>, <PROJECT_NAME>-<PROJECT_NAME>, <PROJECT_NAME_SAMPLE>]]
2014-06-04 10:41:22,458 [ 1726] INFO - der.AndroidGradleTargetBuilder - Gradle build using tasks: [:<PROJECT_NAME>:generateDebugSources, :<PROJECT_NAME_SAMPLE>:generateDebugSources]
2014-06-04 10:41:22,460 [ 1728] INFO - der.AndroidGradleTargetBuilder - About to build project '<PROJECT_NAME>' located at <PATH_TO_MY_PROJECT>
2014-06-04 10:41:22,537 [ 1805] INFO - der.AndroidGradleTargetBuilder - Passing JVM args to Gradle Tooling API: [-Dandroid.home=C:\adt-bundle-windows-x86_64-20131030\sdk]
2014-06-04 10:41:24,934 [ 4202] INFO - .incremental.IncProjectBuilder - org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.
org.jetbrains.jps.incremental.ProjectBuildException: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:877)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:772)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:595)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:352)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:184)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:129)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:224)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:113)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:133)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:55)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:67)
at com.android.tools.idea.jps.builder.AndroidGradleTargetBuilder.doBuild(AndroidGradleTargetBuilder.java:331)
at com.android.tools.idea.jps.builder.AndroidGradleTargetBuilder.build(AndroidGradleTargetBuilder.java:131)
at com.android.tools.idea.jps.builder.AndroidGradleTargetBuilder.build(AndroidGradleTargetBuilder.java:76)
at org.jetbrains.jps.incremental.BuildOperations.buildTarget(BuildOperations.java:101)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:819)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:857)
... 14 more
Caused by: org.gradle.launcher.daemon.client.DaemonConnectionException: The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch:
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\jre\jre,daemonRegistryDir=C:\Users\<USER_NAME>\.gradle\daemon,pid=1644,idleTimeout=null,daemonOpts=-Dfile.encoding=windows-1251]
Actual: DefaultDaemonContext[uid=bb72a914-1081-4f81-a9b1-67c8d0a9106d,javaHome=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\jre,daemonRegistryDir=C:\Users\<USER_NAME>\.gradle\daemon,pid=5592,idleTimeout=60000,daemonOpts=-Dfile.encoding=windows-1251]
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connectToDaemonWithId(DefaultDaemonConnector.java:119)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.startDaemon(DefaultDaemonConnector.java:99)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:72)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:149)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:74)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:42)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:30)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:106)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:93)
at org.gradle.tooling.internal.provider.DefaultConnection.getModel(DefaultConnection.java:133)
at org.gradle.tooling.internal.consumer.connection.ModelBuilderBackedModelProducer.produceModel(ModelBuilderBackedModelProducer.java:44)
at org.gradle.tooling.internal.consumer.connection.GradleBuildAdapterProducer.produceModel(GradleBuildAdapterProducer.java:42)
at org.gradle.tooling.internal.consumer.connection.ModelBuilderBackedConsumerConnection.run(ModelBuilderBackedConsumerConnection.java:50)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:77)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:71)
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:82)
at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:58)
at org.gradle.tooling.internal.consumer.connection.LoggingInitializerConsumerActionExecutor.run(LoggingInitializerConsumerActionExecutor.java:44)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:55)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
... 3 more
Any ideas?
Update
This directory exists:
C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\jre\jre
And I have JAVA_HOME variable it is
C:\Java\jdk1.7.0_45
Also I have 2 gradle.properties files in
C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10\samples\userguide\tutorial\properties\gradle.properties
and
C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10\samples\signing\maven\gradle.properties
I tried to put org.gradle.java.home=C:/Java/jdk1.7.0_45 in each of them, but it did not help me.
What am I doing wrong?
Check your JDK home path in Platform Settings.
In my case it had extra '/jre' suffix, which caused the same error as you described.
I don't know why the daemon tries to use Java from C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\jre\jre (is there such directory) but the problem is likely related to JAVA_HOME env variable or org.gradle.java.home in gradle.properties. http://forums.gradle.org/gradle/topics/gradle_daemon_different_context can give you some hints how to solve the problem.
I was getting this error using JDK 1.7.0_71.
Reverting to using my old 1.7.0_60 fixed it.

Categories

Resources