Abnormal behavior in Android Studio - android

Getting error in Android Studio in an existing project while adding any new file there. Without adding any change the code is running perfectly. I have tried with the following solution :
c:\Users\.gradle\caches\
c:\Users\.AndroidStudio3.2\system\caches\
from this below link:
Unknown attribute android
but it did not work me. Any help in this issue will be appreciated.

My first troubleshooting task would be to try Invalidating Caches and Restart?
On Linux, that is under File -> Invalidate Caches/Restart
Not sure of the exact location on Windows, but it should be in a similar location.
It might help garner more answers if you added more specifics about your issue in your OP.

Related

How to resume a stuck code analysis in Android Studio?

I recently noticed a behaviour, that the default code analysis does not finish anymore in one of my android projects, in particular in kotlin files - unfortunately without an error message. With a stuck analysis I am not able to identify errors in my code anymore and basic stuff like autocompletion does not work, which makes it unable to work.
In the top right corner of the opened file I constantly get Analyzing...
I already tried restarting Android Studio, invalidating its cache, deleting and cloning my project again, rebooting and deleting all kind of gradle and Android Studio cache files but without success.
I finally got it working again with the help of the idea.log file, which can be found via Help > Show Log in Explorer in Android Studio.
The log stated an Exception while analyzing expression at different locations in my files, caused by java.lang.IllegalStateException: #NotNull method org/jetbrains/kotlin/builtins/KotlinBuiltIns.getBuiltInClassByFqName must not return null.
Since it looked like a Kotlin related issue, I upgraded org.jetbrains.kotlin:kotlin-stdlib-jdk7 in my build.gradle from 1.4.10 to 1.5.10 and it worked instantly again. I hope the info helps anyone!
Please remove butterknife plugin in Settings-> Plugin. It is worked for me in java files.

Build error resource directory not found

I'v created a new android project in vs 2013 and installed Android.Support.Library.v7.AppCompat package and dependencies. But when I build the project, I got an error that says
resource directory
'[ProjectPath]\obj\Debug\resourcecache\B81A750477D10031D1844681B0F7EB17\res'
does not exist file: [ProjectPath]\AAPT
I'v cleaned the project
reopen it
rebuild it
but not help me.
I have encountered the same issue as you and have found a solution. I know this has been a long time since your post. Just put the solution here to help someone encounter similar issues.
My project can be built successfully previously, so this error must be caused by some kind of settings. A reasonable explanation and solution can be found in this link: http://smstuebe.de/2016/10/29/fix-android-app-compat/
This is caused by the incomplete Android SDK packages. The normal clean/rebuild won't help. Even if I reinstalled VS2015+Xamarin, I still have this issue.
So try the above solution if you came across similar issues.

"java.exe" exited with code 2

I added Google play services to my project for maps but now keep getting this error "java.exe" exited with code 2.
I am not sure if it is different from "java.exe" exited with code 1 but I have tried all the suggestions online
My heap size is 1G. My target version is 21, I have clean rebuild etc..
When I click on the error it takes me to this CompileToDalvik.
How can I resolve this? Even if I remove google play services I still get this error( clean / refresh rebuild etc..)
We had similar issues and nailed it down to our app going over 64k (65,536) methods limit which could be what's happening when you reference google play services.
Enabling multidex resolved our issue so may be worth trying.
Google Multi-Dex Reference:
http://developer.android.com/tools/building/multidex.html
Using Visual Studio and Xamarin I got this error because I had a wrong path for the Keystore in the .csproj file, and for some reason this path did not get updated while changing the path for the Keystore in the Visual Studio GUI.
Manual correcting the path in the .csproj file solved it for me.
None of the others answers worked for me. What worked for me (but I don't know why) was to empty my bin and obj directories before doing a rebuild.
I've seen this error recently. It was caused by an invalid (layout) xml file. Unfortunately, you don't get more hints where exactly the problem is :( I'd try to exclude the xml files one by one and check if the build succeeds without a certain file. Good luck!
Edit : I'm not even sure it actually was a layout xml file, maybe it has been a style or color xml :/ Any recent changes to one of those?
Increasing the Java Heap Size to 1G is worked for me!
Clean the Bin and the Obj folders, and rebuild again.
If it doesn't work please check different JDK version.
I had this error when switching from VS Mac to VS Windows.
Here the topic Switching From VS Mac To VS Windows got “java.exe” exited with code 2
The issue was comming from the Android.csproj and the Keystore Path.
It was set to my Mac Path even if I had already changed it on
VSWindows AndroidProject => Properties => Signin
So I removed this lines on Android.csproj (edited with third text editor):
<AndroidKeyStore>True</AndroidKeyStore>
<AndroidSigningKeyStore>YourMacPath/Alias.keystore</AndroidSigningKeyStore>
<AndroidSigningStorePass>Password</AndroidSigningStorePass>
<AndroidSigningKeyAlias>Alias</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>AliasPassword</AndroidSigningKeyPass>
On debug & release Part.
Then you can edit them on VS Windows.
Hope I helped someone.
See ya
Now in VS 2022, I had the very same problem and nothing would work. I had noticed that, at least in my case, problem started when I accidentally lost the certificate from the keystore. For debugging mode I just took the signature out since it provides it's own. However, I will need to re-add the key once I change to release. Once the proper key is found in the keystore, the problem is resolved. Apparently that error code is useless.

Eclipse does not open my workspace

I am getting this error when loading my workspace in eclipse.
An error has occurred.See the log file
D:\XXX\App_name\.metadata\.log.
I can able to open other workspaces and also able to create new onw.I didnt save the copy of my code.Please anyone help me?
Thanks!!!
Thanks for all who commented for my question.I tried your answers but I can resolve that issue by removing this folder from my .plugin folder,
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi.
Thanks
Try typing the following in the console:
C:\path\to\eclipse\eclipse -clean
I faced similar problem while running Eclipse neon with Java 9(latest). I used to get error in .metadata.log . Class not found exception.
Checked in eclipse forum and they had a know error with Java 9. Work around was to use java 8. I tried that and it worked for me. Fix should be out anytime soon.
There are other work around but i did not need it since my project required java 8 anyhow.
When you try to add plugins via Eclipse IDE (Help->install new software) the problem occurs.
I suggest you to get the relevant plugin using there official website or in IDE (Help ->Eclipse market place).

"Couldn't resolve resource" in Android Studio's Preview

After adding new items in strings.xml, quite often they don't start working immediately in Android Studio's Preview.
Couldn't resolve resource #string/faq_customer_service
Preview looks like this:
I've obviously tried to re-build the project, and even run gradle clean assembleDebug, but it doesn't seem to help. On emulator & real device the newly-added string resources do work.
Any trick to force Android Studio to reload the resources so that the correct texts show up in Preview?
The only reliable way I've found so far is reloading the project / restarting Android Studio.
Quickest way to do that is File → Invalidate caches / Restart... → Just Restart.
Feel free to post better solutions!
you DO NOT need to close the entire project. It's just way too much for so little problem.
Just refresh the preview (click the "refresh" button)
provided from https://stackoverflow.com/a/34754707/3339597
Right click on project and Synchronize '...Project' worked for me.
There are three steps for solving this problem
Build -->Clean Project
Build -->Rebuild Project
Restart android studio
Couldn't resolve resource #string/faq_customer_service
or
Couldn't resolve resource #id/visible
or
Couldn't resolve resource #id/masked
The solution is if you implement TextInputLayout the above problems may arise ... so Simply add those id or strings to xml files as their property.
Render Problem:
Couldn't resolve resource #string/hello_blank_fragment
Just refresh the Layout.
work for me..

Categories

Resources