Kotlin Android Extensions bug in Android Studio Canary - android

Does anyone have this weird glitch that came with AS Canary 16 that when you build the app all the references via Kotlin Android Extensions light up red and show compilation error.
Even though the app builds I loose all autocomplete on Views and auto import always deletes imports for methods that are called on views because it thinks that they are not used.
Clean build helps sometimes but not always. Can anyone suggest how to fix this irritating issue?

Looks like this is an issue with Android Synthetics in Kotlin. There is an open issue with JetBrains for it. You can track it here:
https://youtrack.jetbrains.com/issue/KT-23908
The reporter states that he can simply re-sync Gradle and things go back to normal. This works for me some of the time, but often times I will have to close & re-open the entire project. Rare occasions require actually quitting the IDE. Even more rare, I have to clear IDE caches. After all that, if I still have problems, I'll delete .gradle/caches and let everything re-sync & re-download.
Definitely a huge headache.

Related

Code Suggestions stopped Working (Flutter)

After creating a new Flutter Project in VSCode/Android Studio, there are just no code suggestions. Pressing ctrl+space usually brought up suggestions in both, but now on Android Studio it says no suggestions, and on VSCode I get the usual few snippets, no IntelliSense.
Weird thing is when I tried reopening previous projects, some projects are still fine, some projects have the same issue. I have attached screenshots of when it works, and when it doesn't
PS: I'm not sure if this is related but in VSCode just when a new project is made it fails to recognise the header file so it highlights everything as Error though the code runs fine. However this gets fixed when the window is reloaded
This usually happens when your IDE is not sync with the version of Dart and/or Flutter used in the project ; that's why on some projects it still works, and not on the other.
Option 1 :
Try to update your Dart/Flutter version on the project, and on the plugin/extension of the IDE. Watch out to have the last version of your IDE, not on beta channel, as well.
Option 2 :
If still not working after the update, delete IDE related files in problematic projects and reopen them.
Last time worked for me, hope it will for you !

Do not build Android project automatically on opening

I have been using Android studio for a long time, yet never understood what are the processes that Android studio runs at when we load a new project via File>New or File>Open. We just load the project and have to wait for so many minutes before the android studio completes those processes (I know that we can still click on file names and editor would open them, but i have observed the android studio will still lag until all those processes are completed)
However I don't know how, recently My Android studio started behaving differently. I don't know what i did, But every time i created a new project, or loaded a previous one, it would show a message like this:
This was very good for me, because even when i don't click the try again
button, I am still able to access all files and without any lag, thereby removing a need for external file editor. I feel this was some bug in gradle or cache handling that got fixed when i uninstalled AS and updated to AS 3.5 .
So is there a way to manually run all those build and indexing processes, instead of Android Studio just running them automatically?
UPDATE:
I think i was not clear before. I want that error to occur . Meaning I want to have a control over when the building process starts. Also, I am NOT having any error as of now, all my projects are working fine.
Look for highlighted warnings in you Gradle file, you may need to update some things and then sync again.
You could also try to clean and rebuild your project.
You can also File->Invalidate Caches / Restart if none of the above work.
If none of the above work, please provide more details on what warnings/errors you get.
When version conflict in gradle file, it cant be able to build and sync the project.There may be show "Unsupported Modules Detected: Compilation is not supported for following modules”. Fix them too

Plugin Error: Kotlin threw an uncaught IllegalStateException

Second (I believe; could also be third) time today I'm confronted with this
Plugin Error: Kotlin threw an uncaught IllegalStateException.
with the only option being to disable the plugin.
I don't do that and just restart Android Studio (3.0 Beta 6).
So far, I have yet to encounter any side-effects other than that one-time pop-up, so I guess this could just be related to my accidentally mistyping something (which would still be very strange a reason to fail completely), but ... is there any way to check what happened? Because this error message doesn't say terribly much and even if I couldn't do anything about it, it's not even useful to report something like this.
If it matters, I have recently updated the kotlin plugin (because android studio showed me a pop-up suggesting I should). Of course I also updated my gradle build file so it reads
ext.kotlin_version = '1.1.4-3'
However, as I'm only just learning Kotlin, I haven't actually used it long enough to say whether this might have occured if I hadn't updated the Kotlin plugin. So it may or may not be related. ¯\_(ツ)_/¯
I've been getting these lately, sometimes AS keeps working, sometimes not. The best remedy so far for me is a hit on Invalidate Caches / Restart.
Happy coding.

Gradle not syncing at all?

I just updated AS since a while and Gradle seems to be broken.
Create a empty LibGDX gradle project with the latest LibGDX setup.
Add dependency to core in build.gradle. Nothing happens, used to get a popup with something like "Sync now" I believe.
Clean project does not seem to do anything. Bottom left says nothing about a recent (un)successful clean.
Rebuild project does not seem to do anything.
Adding jibberish sdfdfsdfsffsd;;;sfes;efs to the gradle file does not change anything. My program still runs, no errors in build.gradle and clean still does not do anything.
Never really had problems with AS and Gradle, it just worked out of the box. Now it seems to be broken but I cannot seem to find anything on the subject. A reinstall might fix things but fixing it without a reinstall would be nice.
Edit
I somehow managed to trigger the gradle sync by closing/opening AS and opening my project again. But now it won't even recognize the LibGDX framework anymore.
Edit
Somehow it seems related with unchecking Android in the LibGDX setup tool. This was no problem in the past for me but once I tried to create a project with the android module enabled it seems to work. My guess is the LibGDX tool messes up somewhere with generating the gradle files but it's still very strange behavior. Perhaps someone could attempt to start a project without the android module and tell me if he is running into the same issues. Note that at first import the default LibGDX program runs fine but importing dependencies through Gradle and restarting AS is causing issues here.

Eclipse error mark doesn't disappear after fix

I'm developing an Android application on Eclipse Juno, and using a MAC OS Lion.
When I fix some error in a xml file the error mark doesn't disappear, and it doesn't let me compile the code even if I fix it. I tried deleting it through Window-> Show View -> Problems , but when i compile the code, the error came back. The only way i figured out to solve it is to crop all the content in the file, save the xml without errors and then paste the same code inside the xml file again, the error just go away as if there wasn't anything there.
Does anyone now why it happens?
Grahaminn is correct in that seeing the code would be helpful in case there is something that you are missing. However, since you say that it goes away once you cut, save, and paste, I believe you did take care of the error. While I've never found an answer to the same question other than the eclipse compiler obviously has bugs, I have had the same thing happen and have had to resolve the issue in the same way. The compiler, for whatever reason, still sees the error instead of the fix. It is very frustrating but we are stuck doing what you have done until the compiler is fixed.
Update your Android development tools. That bug (Android Lint issues remain even after correcting them) was fixed in ADT 20.0.2.
If you can't or don't want to upgrade, you have the options of
cleaning the project
manually running Android Lint again.
But similar errors will occur again from time to time then.
Thanks for all the answers. My Eclipse is working properly at least until now, the only thing with still giving me headaches is the R.java file which keep disappearing sometimes , but thats due to problems with ADT i guess. I uninstalled the ADT plugin and installed it again.

Categories

Resources