Why does Android Studio Arctic Fox fail to sync my project - android-studio

Android Studio Arctic fox 2020.3.1 Patch 2 fails with th following error in idea.log:
ERROR - intellij.openapi.progress.Task - java.lang.IllegalStateException: Can't resolve library via LibraryId(name=Gradle: com.google.j2objc:j2objc-annotations:1.3, tableId=com.intellij.workspaceModel.storage.bridgeEntities.LibraryTableId$ProjectLibraryTableId#4b9d4a4e)
java.lang.RuntimeException: java.lang.IllegalStateException: Can't resolve library via LibraryId(name=Gradle: com.google.j2objc:j2objc-annotations:1.3, tableId=com.intellij.workspaceModel.storage.bridgeEntities.LibraryTableId$ProjectLibraryTableId#4b9d4a4e)
I have a suspicion that the concrete lib in question is a bit random. Before I upgraded from Patch 1 to Patch 2, the error said:
Caused by: java.lang.IllegalStateException: Can't resolve library via LibraryId(name=Gradle: androidx.exifinterface:exifinterface:1.0.0#aar, tableId=com.intellij.workspaceModel.storage.bridgeEntities.LibraryTableId$ProjectLibraryTableId#73f6fd09)
Gradle syncs just fine - the sync finishes with BUILD SUCCESSFUL in 5s . It's definitely Android studio that is the problem. Any Idea?

File > Invalidate Cache and Restart solved the problem

Related

java.lang.NullPointerException at com.android.build.gradle.internal.ndk.NdkHandler.getPlatformVersion

I upgraded my android studio to:
Android Studio Bumblebee | 2021.1.1 Patch 1
and now my project does not build anymore with two error that I can't understand.
First I get this:
cvc-complex-type.2.4.d: Invalid content was found starting with element 'base-extension'. No child element is expected at this point.
What is it? I don't even know which file is causing the issue.
Second, I get a weird null pointer exception looking for the NDK version
Caused by: java.lang.NullPointerException
at com.android.build.gradle.internal.ndk.NdkHandler.getPlatformVersion(NdkHandler.java:121)
I tried this thread which tells me to install the NDK manually and change my local.properties to this but it did not work either.
Gradle sync failed: A problem occurred configuring project ':lib'
sdk.dir=C\:\\Users\\<user>\\AppData\\Local\\Android\\Sdk
ndk.dir=C\:\\Users\\<user>\\AppData\\Local\\Android\\Sdk\\ndk\\23.1.7779620
Any clues?
thank you.

Why am I getting 'manifestOutputDirectory' error after android studio update?

My android studio has just updated and after that my app is not able to compile anymore. It shows this error:
Execution failed for task ':app:processDebugManifest'.
Could not get unknown property 'manifestOutputDirectory' for task ':app:processDebugManifest' of type
com.android.build.gradle.tasks.ProcessMultiApkApplicationManifest.
Android studio: 4.1
Android gradle plugin version: 4.1.0
Gradle: 6.6.1
It was an outdated Huawei's AG Connect plugin. Solution here: stackoverflow.com/a/64390789/1363087

Unable to update from android studio 3.1.4 to 3.4.1

I am trying to update android studio from 3.1.4 to 3.4.1 it showing below error while patch:
ERROR Patch.apply - apply failed
java.io.IOException: Impossibile trovare il file specificato
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:233)
at com.intellij.updater.Utils.copyStream(Utils.java:237)
at ie.wombat.jbdiff.JBPatch.realAllFileContent(JBPatch.java:141)
at ie.wombat.jbdiff.JBPatch.bspatch(JBPatch.java:67)
at
com.intellij.updater.DiffAlgorithm$JBDiffAlgorithm.applyDiff
(DiffAlgorithm.java:118)
at
com.intellij.updater.BaseUpdateAction.applyDiff(BaseUpdateAction.java:145)
at com.intellij.updater.UpdateAction.doApply(UpdateAction.java:55)
at com.intellij.updater.PatchAction.apply(PatchAction.java:199)
at com.intellij.updater.Patch.lambda$apply$3(Patch.java:399)
at com.intellij.updater.Patch.forEach(Patch.java:471)
at com.intellij.updater.Patch.apply(Patch.java:390)
at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:64)
at com.intellij.updater.Runner.install(Runner.java:357)
at com.intellij.updater.Runner.main(Runner.java:131)
any clue?
as pointed by #Gabriele Mariotti invalidate cache and restart seems, in the second try, to resolve the problem

Gradle sync failed after upgrade to Android Studio 3.0 Beta 1

A project syncing and building OK when on Android Studio 3.0 Canary 9. Just started failing the Gradle sync immediately after the upgrade to Android Studio 3.0 Beta 1!
Using the Android Studio bundled Java 8 without hacks on a Debian GNU/Linux 9 (Stretch, stable, up-to-date).
UPDATE: Solved with Beta 2
https://androidstudio.googleblog.com/2017/08/android-studio-30-beta-2.html
Note: additional effort needed on rewriting code to avoid problematic Java libs for Android.
UPDATE: First try from Google
https://androidstudio.googleblog.com/2017/08/android-studio-30-beta-1.html
Several issues arise (e.g., errors about signature-polymorphic method without --min-sdk-version >= 26)
These issues were not present on Canary 9!
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: org.gradle.tooling.BuildException: com.android.dx.cf.code.SimException: signature-polymorphic method called without --min-sdk-version >= 26
(Google's nonsolution)
Original sync issue
Same issue on a Windows
Gradle error upgrading to Android Studio 3.0 Beta 1
From Studio
Build: 3.0 Beta 1, AI-171.4243858, 201708032321,
AI-171.4243858, JRE 1.8.0_152-release-915-b01x64 JetBrains s.r.o, OS Linux(amd64) v4.9.0-3-amd64 unknown, screens 1920x1080, 1920x1080
Gradle '...' project refresh failed
Cause: java.lang.NullPointerException
at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77)
at sun.nio.fs.UnixPath.<init>(UnixPath.java:71)
at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
at java.nio.file.Paths.get(Paths.java:84)
at com.android.build.gradle.internal.scope.BuildOutput.getOutputPath(BuildOutput.java:222)
at com.android.build.gradle.internal.scope.BuildOutputs.lambda$load$2(BuildOutputs.java:243)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1376)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at com.android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.java:245)
at com.android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.java:184)
at com.android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.java:140)
at com.android.build.gradle.internal.ide.BuildOutputsSupplier.lambda$get$1(BuildOutputsSupplier.java:55)
at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:397)
at com.android.build.gradle.internal.ide.BuildOutputsSupplier.get(BuildOutputsSupplier.java:50)
at com.android.build.gradle.internal.ide.BuildOutputsSupplier.get(BuildOutputsSupplier.java:35)
at com.android.build.gradle.internal.ide.AndroidArtifactImpl.getOutputs(AndroidArtifactImpl.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$ReflectionMethodInvoker.invoke(ProtocolToModelAdapter.java:592)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$AdaptingMethodInvoker.invoke(ProtocolToModelAdapter.java:397)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$PropertyCachingMethodInvoker.invoke(ProtocolToModelAdapter.java:625)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SafeMethodInvoker.invoke(ProtocolToModelAdapter.java:647)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SupportedPropertyInvoker.invoke(ProtocolToModelAdapter.java:670)
at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$InvocationHandlerImpl.invoke(ProtocolToModelAdapter.java:356)
at com.sun.proxy.$Proxy220.getOutputs(Unknown Source)
at com.android.tools.idea.gradle.project.model.ide.android.IdeAndroidArtifactImpl.<init>(IdeAndroidArtifactImpl.java:57)
at com.android.tools.idea.gradle.project.model.ide.android.IdeVariantImpl.lambda$new$0(IdeVariantImpl.java:60)
at com.android.tools.idea.gradle.project.model.ide.android.ModelCache.lambda$computeIfAbsent$0(ModelCache.java:31)
at java.util.HashMap.computeIfAbsent(HashMap.java:1126)
at com.android.tools.idea.gradle.project.model.ide.android.ModelCache.computeIfAbsent(ModelCache.java:31)
at com.android.tools.idea.gradle.project.model.ide.android.IdeVariantImpl.<init>(IdeVariantImpl.java:59)
at com.android.tools.idea.gradle.project.model.ide.android.IdeAndroidProjectImpl.lambda$new$4(IdeAndroidProjectImpl.java:88)
at com.android.tools.idea.gradle.project.model.ide.android.ModelCache.lambda$computeIfAbsent$0(ModelCache.java:31)
at java.util.HashMap.computeIfAbsent(HashMap.java:1126)
at com.android.tools.idea.gradle.project.model.ide.android.ModelCache.computeIfAbsent(ModelCache.java:31)
at com.android.tools.idea.gradle.project.model.ide.android.IdeModel.copy(IdeModel.java:74)
at com.android.tools.idea.gradle.project.model.ide.android.IdeAndroidProjectImpl.<init>(IdeAndroidProjectImpl.java:87)
at com.android.tools.idea.gradle.project.model.ide.android.IdeAndroidProjectImpl.<init>(IdeAndroidProjectImpl.java:68)
at com.android.tools.idea.gradle.project.model.AndroidModuleModel.<init>(AndroidModuleModel.java:131)
at com.android.tools.idea.gradle.project.sync.idea.AndroidGradleProjectResolver.populateModuleContentRoots(AndroidGradleProjectResolver.java:214)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:103)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:366)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.access$200(GradleProjectResolver.java:79)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:902)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:886)
at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:218)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:139)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:79)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.lambda$resolveProjectInfo$0(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:45)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:66)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:139)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:125)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:388)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:445)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:726)
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.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:137)
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)
UPDATE: Android Studio 3.0 Beta 3
With the following list of bug fixes:
Seems like this issue is already gone. After Updating from 3.0 Beta 2 to 3.0 Beta 3, I don't have to manually clean the project.
UPDATE: Android Studio 3.0 Beta 2
From the official Android Studio 3.0 Beta 2 known issues:
If you have an existing Android Studio project that's
using an alpha version of Android plugin 3.0.0 (such as 3.0.0-alpha9),
you may get the following error when you migrate to Android plugin
3.0.0-beta1 (or higher) and sync your project: Gradle project refresh failed.
Resolve this issue by selecting Build > Clean Project from the menu bar.
You can fix this issue by doing this:
Build > Clean Project
Reference: https://androidstudio.googleblog.com/2017/08/android-studio-30-beta-1.html
Read here:
https://androidstudio.googleblog.com/2017/08/android-studio-30-beta-1.html
Open the Terminal window by selecting View > Tool Windows > Terminal from the menu bar.
Delete all intermediate and cached build files with the following command: gradlew clean.
Build your project with the following command: gradlew assemble.
Sync your project files with Gradle by clicking Sync Project from the toolbar.
Or as I did, open the tab "Gradle" and run "clean" and then "assemble"
like this:
Go to your right at Android Studio, open the tab "gradle", then in ":app"/"Tasks"/"build" you will see "clean", "assemble" and other tasks.
Run first clean and then assemble, you may get an error but it still works and finally rebuild your project.
There is a solution offered by Google:
Resolve this issue selecting Build > Clean Project from the menu bar. You need to perform this action only once for each project. You can then sync your project files with Gradle by clicking Sync Project from the toolbar.
Following solutions didn't work for me :
Pressing that try again button again and again
Using offline and online gradle changes
Cleaning, syncing or rebuilding.
Solution:
After all these I just visited ~/.gradle folder, it contains a single folder named wrapper, just rename it to anything else i.e. wrapper123. That's it problem solved !!!! Press build and it will start syncing and building the project
I'm on Android Studio 3.0 Beta 2, and I found that on top of the clean and sync proposed here, for my project which was Java-Kotlin-mixed code base, I had to drop my Kotlin version to 1.1.3-2, which is the IDE bundled version, clean & sync then works, and then I can bring the Kotlin version back to 1.1.4 which is latest at the time of writing.
recquired online for until fix the error (fixing the gradle error.after successfully fixed the errror.you can work in offline.)
1.download latest gradle from ->https://gradle.org/releases
2.after downloading the zip files,it extract all the files into a folder (for good work:-name the folder 'gradle4',place the samelocal disc where your android studio installed eg-you installed android studio in local disc :c if place the 'gradle4' in local disc c)
3.android studio->file menu->settings->build,Excecution,Deployment->Gradle
4.check-use local gradle distribution
5.give gradle folder path into the gradle home optionScreen shot of gradle setting step 5
6.Enable embedded Maven Repository
Screen shot of Enable Maven Repository
click ->apply
Build menu->clean project
-problem solved-

Android Studio 2 error :app:compileDebugJavaWithJack

This is the complete error from Android Studio 2.1.1. I know this code compiles because on other PC it does, just not on this one which has Windows 10 x64. All other projects fail with similar result.
Error:Execution failed for task ':app:compileDebugJavaWithJack'.
> java.lang.RuntimeException: java.lang.AssertionError: com.android.jack.library.LibraryIOException: I/O error when accessing file 'I:\Android\KeepVidDownloader\Android\app\build\intermediates\packaged\debug\classes.zip': Failed to delete directory 'C:\Users\BCDIAC~1\AppData\Local\Temp\vfs-1464787788985-0'
For Build -> Clean Project I have used the solution from here https://stackoverflow.com/a/32924320/1958032
I think that there could be a similar solution for running/making the app.
How to solve this?
This issue is a conflict between antivirus and Android Studio.
In my case using Avira, Windows 10 and Android Studio 2.2.
I just disabled Avira for the first build and enabled it again when build was complete.
No need to do this every time- only at the first build.
I had a similar problem and solved it by File->Invalidate Caches and Restart.

Resources