Error when updating Android Studio - android

When I try update my Android Sudio I get this message:
Temp. directory: C:\Users\Rick\AppData\Local\Temp\
+----------------
| A file operation failed.
| This might be due to a file being locked by another
| application. Please try closing any application
| that uses the files being updated then press 'Retry'.
+----------------
com.intellij.updater.RetryException: Cannot delete file C:\Users\Rick\AppData\Local\Android\android-studio\plugins\gradle\lib\gradle-tooling-extension-impl.jar
at com.intellij.updater.BaseUpdateAction.replaceUpdated(BaseUpdateAction.java:40)
at com.intellij.updater.UpdateZipAction.doApply(UpdateZipAction.java:199)
at com.intellij.updater.PatchAction.apply(PatchAction.java:140)
at com.intellij.updater.Patch$3.forEach(Patch.java:198)
at com.intellij.updater.Patch.forEach(Patch.java:248)
at com.intellij.updater.Patch.apply(Patch.java:194)
at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:86)
at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:77)
at com.intellij.updater.Runner.doInstallImpl(Runner.java:307)
at com.intellij.updater.Runner.doInstall(Runner.java:268)
at com.intellij.updater.Runner.access$000(Runner.java:18)
at com.intellij.updater.Runner$2.execute(Runner.java:258)
at com.intellij.updater.SwingUpdaterUI$7.run(SwingUpdaterUI.java:230)
at java.lang.Thread.run(Thread.java:745)

The file Android\android-studio\plugins\gradle\lib\gradle-tooling-extension-impl.jar is probably in use by some JVM process (shown as java.exe in Task Manager).
Solution that worked for me was to close the updater and close all java.exe processes in Task Manager, then open Android Studio and try updating once more. This time the update should go all the way through.

A workaround:
1-Close Android Studio.
2-Right-click "Android Studio" icon and select "Run as administrator".
3-Go to "Help->Check for Update..."

There is no way for updating anything without the rule of updater. And the rule must be administrator or super user.
P.S.
As how it's name, updating is updating, renewing or deleting. Then it knows what it takes.

I was getting the exact error you getting. I left my PC on over night and clicked retry and it worked. Very strange. I also tried using:
handle - http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx
and
Process explorer - http://technet.microsoft.com/en-us/sysinternals/bb896653
to check what is locking that file and they both showed nothing. That is when I clicked retry and it worked

Related

How to resolve gradle timeout waiting to lock file on MacOS m1?

I'm using Android Studio 2020.3.1 Patch 4(at 01-19-2022), Gradle 7.0.2. Java 11 Kotlin 1.6.10, mac Pro 16 m1 arm64(2021)
I'm new in macOS, jumped from Ubuntu, and found issues. I'm working with different projects and all time when I'm trying to switch to another one, I have the next error:
Gradle could not start your build.
Could not create service of type ResourceSnapshotterCacheService using
GradleUserHomeServices.createResourceSnapshotterCacheService(). Timeout waiting to lock file hash cache
It sometimes happens when I'm trying to run or sync the same project.
Solution as find ~/.gradle -type f -name "*.lock" -delete not useful because I run it all time when I complete changes on sdk project and test it on another one. Relevant solutions like kill not useful too
I hope, somebody has a solution for that. Thank you :)
Error text:
Gradle could not start your build.
Could not create service of type ResourceSnapshotterCacheService using GradleUserHomeServices.createResourceSnapshotterCacheService().
Timeout waiting to lock file hash cache (/Users/{user}/.gradle/caches/7.0.2/fileHashes). It is currently in use by another Gradle instance.
Owner PID: 73387
Our PID: 73419
Owner Operation:
Our operation:
Lock file: /Users/{user}/.gradle/caches/7.0.2/fileHashes/fileHashes.lock

Android Studio - App won't open in emulator for an unmodified Basic App template

I just installed Android Studio and have started a new app (Basic App template with toolbar and floating button). I have enabled Virtualization in my BIOS and have added a Pixel 2 (version 29) emulator.
When I press the Run button, the emulator opens the Pixel 2 and powers on, but the app doesn't open and no icons appear (apart from the standard phone, sms, chrome, playstore icons). I press Run again and still nothing happens (apart from Gradle building).
There are no errors that I can see.
Edit: Every now and then when I press Run I see the following error message in Event Log:
8:52 AM Error during Sync: Remote object doesn't exist!
This only occurs sometimes. Other time, it just says:
8:44 AM Executing tasks: [:app:assembleDebug]
8:44 AM Gradle build finished in 3 s 972 ms
I have tried:
Deleting the emulator from AVD Manager then creating a new one (Pixel 2, version 29, everything else left as default).
Deleting the project and creating a new one
Uninstalling and reinstalling Android Studio
Restarting computer
Going to File > Invalidate Caches / Restart and invaliding then restarting
Edit 2:
I was just asked to check Logcat in a comment. There is a lot in there but this part is highlighted red and repeats throughout the logs:
2019-08-02 08:53:21.707 2031-9184/? E/LoadManifestTask: Can't find Chimera operation impl class com.google.android.gms.walletp2p.infra.phenotype.PhenotypeCommitIntentOperation dropping operation
java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.walletp2p.infra.phenotype.PhenotypeCommitIntentOperation" on path: DexPathList[[zip file "/system/product/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_extracted_libs/x86, /system/product/priv-app/PrebuiltGmsCore/lib/x86, /system/product/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk!/lib/x86, /system/lib, /system/product/lib, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at ecj.<init>(:com.google.android.gms#16910022#16.9.10 (040700-247503114):5)
at eck.run(:com.google.android.gms#16910022#16.9.10 (040700-247503114):53)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
This is a very undesirable kind of system bug. Well, the point is here that, sometimes even creating a simple data directory won't work. You would have to go to the source and create a folder yourself. This case is same. Attempting 'Invalidate caches and restating' isn't working, so you have to do it manually. This is how:
Solution:
Close Android Studio
Go to C:\Users\UserName\.android and rename:
build-cache folder to build-cache.bak
Go to C:\Users\UserName\.AndroidStudio3.4.2\system and rename these folders:
caches to caches.bak
compiler to compiler.bak
compile-server to compile-server.bak
conversion to conversion.bak
external_build_system to external_build_system.bak
frameworks to frameworks.bak
gradle to gradle.bak
resource_folder_cache to resource_folder_cache.bak
Open the Android Studio and open your project again.
Hope it solves your case also. Did for me when I faced the same problem around a year ago.

Failed to initialize Git team provider

whenever I add an Android project to a git repository using the eclipse plugin EGit I get this Error message
Failed to initialize Git team provider.
when visualising the error log I get this :
Failed to initialize Git team provider.
Problems encountered while moving resources.
Could not move '/SearchInContatsWithLoader'.
Could not move: D:\AndrComp\SearchInContatsWithLoader.
Problems encountered while deleting files.
Could not delete: D:\AndrComp\SearchInContatsWithLoader\libs\android-support-v4.jar.
Could not delete: D:\AndrComp\SearchInContatsWithLoader\libs.
Could not delete: D:\AndrComp\SearchInContatsWithLoader.
Check if you don't have a windows process blocking those file (keeping an handle on them), which would prevent another process (like EGit) to move them.
To solve the issue, try to close as many processes as you can (or, even better, reboot and launch just Eclipse), and try again your operation.

Can not open draw9patch.bat normally

i installed the newest version of Android SDK,and use SDK Tool Revision 20.0.3, and then i double click the 'draw9patch.bat',i hope it can show me an UI,unfortunately, the bat file just run flashing past, does not show the UI. And then i try to double click 'hierarchyviewer.bat', the program doesn't show an UI either. I don't know why and i can get the ways to solve this problem from the Internet, so i turn to your guys for help.
Make sure you set environment path for java . Open command prompt and navigate to android-sdk\tools\lib folder and type java -jar draw9patch.jar press enter . now you could get see UI screen if no problem with this .jar file .
Probably, "find_java.bat" and it's associated crap exe are failing miserably at doing the one thing it's supposed to do. I don't know how it's supposed to work or why it's failing, and I don't really care. Java is installed and this exe is a failure - so purge the damn dependency and be done with it. Who knows, maybe find_java.exe is some damn NSA virus - never worked for me before (maybe it can't find 64-bit Java... worthless rubbish).
Ahem, yeah, anyway...
Go to draw9patch.bat and change these three lines:
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF
to this (use your Java path):
set java_exe=C:\Program Files\Java\jdk1.7.0_21\bin\java.exe
Then you should even be able to run draw9patch.bat with another bat file wherever you want to place it for convenience, by doing something like this inside the new bat:
call "C:\Program Files (x86)\Android\android-sdk\tools\draw9patch.bat"
No idea why this 'answer' wasn't here a year ago. Open a command prompt... please. :P

Cannot run Android application on emulator/device - activity doesn't exist?

When trying to run my application on the emulator I get an error from the activitymanager:
ActivityManager: Error type 3
My activity exists, is listed in the manifest (in fact, its the MAIN launcher activity).
Anyone know what this error means?
If you are running Eclipse try Projects-->Clean... and clean the project before running again.
i faced the same issue. I cleaned the project and removed the android:enabled=false in android manifest. This solved the issue.
Check "android:installLocation" in your AndroidManifest.xml.
"preferExternal" will cause the problem.
I got this error because I used invalid characters in my project name and Android didn't warned me about it so I had no idea that was the problem...
Example: "Thís ís íncorrect!"
nothing to worry about that it happens sometimes when activity manager unable to find activity of your app that means your target that is emulator is not started yet or may be because of following reason:
when you try to run your app on emulator you may be cancled in between building or forcefully closed your emulator.In that case when try to start emulator again it will sometimes not maximized.
now you have to restart your eclipse and then launch emulator and run your app now you will not face this type of error
Dont remember how I fixed this - most probably I wiped the local copy and re-checked out of svn.
ActivityManager: Error type 3
I don't know how true it is, but I used the same shared preferences file from another app..and got this error. I chose a new name for the shared preferences and the problem has gone away. It's working now
I had not enough space on my phone, that's why I had this problem.
So I cleaned it and go RUN )
I got this error when I mistakenly added a second application tag in my manifest as I was trying to add hardware acceleration to my app:
<application
android:hardwareAccelerated="true" />.
I added it above my actual application tag and I think this resulted in Android deploying an empty 'app' to my phone. It reported 'Installation success' in the logs and yet there was no launcher icon. It did appear, though, under Settings -> Apps but the only thing I could do there was to uninstall it. Hope this helps someone.
Thus, it seems there can be many reasons to see this error.
For those who can't fix it using the above mentioned methods:
In my case, i renamed the name of my activity (using F2 in Eclipse) and it is fixed.

Categories

Resources