Gradle not syncing at all? - android

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.

Related

why does Android Studio not recognize functions?

I did not change anything in my code, nor in the grade file, but I clicked on the update gradle notification android studio gets from time to time. I am not sure what the problem is but suddenly the IDE does not recognize some functions anymore, like String methods
also this icon changed:
My old project runs, but when I create a new project it won't work it says:
Error running 'app': Default Activity not found.
Help would be much appreciated.
I had the same issue I tried closing android down and restarted it up again and it started working, couldn't tell you why it happened though.
Try cleaning your project and rebuilding it from the Build Option. I have experienced this a lot of time as well. This works for me. As to why it works, I am not sure it. Hopefully someone would soon pitch in.
Go to C:\Users\{user}\.AndroidStudio4.0\system
and delete the caches folder.
Tried a lot of things I found online, but only this worked.

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

Kotlin Android Extensions bug in Android Studio Canary

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.

Android Pre-Dex: Android SDK is not specified without android SDK

I get this error in IDEA, but I don't want to use an Android SDK. I've been able to build and run just fine before, and one day I just opened my project like I usually do, and I started getting this error.
I'm working on a game with libgdx, and I've taken out all android dependencies (in the settings and build files). It has worked just fine before, how do I stop this error from happening?
Also, I can do ./gradlew desktop:build and ./gradlew desktop:run and everything works fine. So I'm guessing it's an IDEA thing...
Edit: In the suggested duplicate, the solution is to add a reference to the Android SDK. I don't want to use the Android SDK, so I can't use the solution on the suggested duplicate.
So I figured it out.
This was an IDEA problem, not a gradlew or LibGDX problem.
If someone wants to use LibGDX but without the Android SDK you need to do the following:
Remove 'android' from settings.gradle
Remove the android macro in the build.gradle
If you get the 'Android Pre Dex' error when trying to run in IDEA, you need to remove all Android references. It was under Project Structure -> Modules, one of the Modules will have an Android reference. Delete it, and you should be good to go!

LibGDX on Netbeans - Compiles fine but Nebeans says "Package Android does not exist"

I've looked near and far for an answer.
My libgdx project works great, it compiles and it runs. Android, desktop and IOS (on my mac).
But Netbeans (8.1) shows all my android imports as errors and says "Package Android does not exist" even though it compiles fine.
My project is created with the Libgdx wizard and there for uses gradle.
How do I fix this?
Edit:
I added a workaround! I add the following to my build.gradle file
dependencies {
compile files('libs/android.jar');
}
Reload the project and there! It finds everything!
Then I comment that line out without reloading the project and then the compile works :)
i'm using netbeans for java, and was seeing the same error
for me, after disabling the maven plugin, shutting down, deleting the cache, and restarting, an error dialog popped up saying junit 3.8.2 had been removed and offering to automatically "fix" it. and that resolved the issue
this has the downside that i wont be able to open older versions in netbeans (without jumping thru these hoops every time), making bisects prohibitive

Categories

Resources