Why does android studio allow me to compile with syntax errors - android

Hi this may sound like a weird question, but I am new to Android Studio. So far I really like it, but there is one thing that is bugging me. In Eclipse if I ever had a syntax error in my code for example I forgot a ; or something like that. It would not allow me to build my project until I fixed the error.
In android studio I removed some buttons that are referenced several times in the code, and I expected it to gong it and tell me all the places that I referenced the button, but it just runs like normal. Then whenever I get to the part in code where those buttons are referenced the app just crashes.
Is there a way to get Android Studio to find syntax errors?

Eclipse uses a specially instrumented compiler to find errors. The compiler that is compiling your code is the the thing that is generating error messages you see in the IDE
Studio (and Netbeans, incidentally) don't work like that. Your app is assembled by an external build system (Gradle, in the case of Studio), using whatever tools it finds. Studio, independently, generates error messages by analyzing artifacts.
Every now and then, Studio gets out of sync. A rebuild will usually fix it.

Related

GradleException Log location

I need some help finding the Gradle build logs in Android Studio. I keep running into compatibility issues when adding new Android features to my apps. My latest one was adding Room db. My app compiles fine. I add the new dependencies in build.gradle and the app compiles fine again. As soon as I start trying to use Room I try to build my app it fails. I end up spending hours trying to troubleshoot my build.gradle files to find my errors. (This has happened a few times) The Error I got this time is:
org.gradle.api.GradleException: Compilation error. See log for more
details.
I can't find where the log is. I am using Android Studio Chipmunk in Fedora 36. I saw an old posts that showed a buttons and links to the logs. The posts were older and the users were on Windows and Mac-OS. I don't seem to have them in the Linux version. I can't be the only one running into this. This seems like such a novice issue but I have been looking for a while and can't find the answer. I don't know how to effectively troubleshoot this if I can't see the detailed errors. Any help is greatly appreciated.
My build.gradle logs are located in /tmp.
I found them by going to the Help menu then selecting Collect Logs and Diagnostic Data in Android Studio. This then gave me a popup with an option to Show in Files. The file that appears to contain the data is kotlin-daemon.timestamp.log where time stamp is going to by different for you.

Lime 5.2.1 / Android 4.3 : dlopen fails on stpcpy

I'm trying to build an empty HaxePunk project for Android to test the build chain, and while I'm never getting any error, all my attemps have crashed at run time with the same error message :
Error: dlopen failed: cannot locate symbol "stpcpy" referenced by libzlib.so...
I am running the executable on a pretty old phone with Android 4.3 on it ; a Sony Xperia M.
I have been doing a bit of research, and so far I mostly see the same things being repeated : update your NDK (I've been using the latest one from the android dev website and not the one lime setup android downloads), build for previous API versions (which I am also doing with <config:android target-sdk-version="18" /> in my project.xml file). So I don't know what I'm doing wrong, if anything.
Another thing I found is that I'm using the git version of HXCPP, and when I built the Android libs with neko build.n android in the project subdir, it was using -DHXCPP_ANDROID_PLATFORM=26 whereas the Lime build of my project is using -DHXCPP_ANDROID_PLATFORM=9, so that can't be good. However, I don't really know much about Android at all, but I have read that the SDK version and Android platform are two different things, or so I've read.
Any help with this will be much appreciated.
EDIT : Okay so something weird happened : up until now I was trying to install the APK manually by copying it to my phone's files and launching it from there, which kept crashing. I tried lime test android once without changing anything at all and it worked fine, and from then I could manually install the APK like I used to, and the error never happened again. I can't replicate it, but it's still an open case.

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.

Android IntelliJ IDEA 14.1: No main class for module

I previously had a working android project when I was using IntelliJ IDEA 14. I could run the project by pressing the play button, and it would install and start the application on my device.
I recently updated to 14.1. The code still appears to compile fine, I can see that it generates an APK and I can view it in the output folder (out/production/myapp/myapp.apk), but now I get an error when I attempt to run the project:
Error:No main class for module: app
I've tried creating two new projects, one based on the Android->Application Module template and another based on the Android->Gradle: Application Module template, and both have the same issue - they spit out the error above with the default configuration.
I assume that this must work on other users boxes, particularly because I haven't found anything online or any bug reports about it, but I guess there is a very minute possibility that I'm the first one to find this.
Is this an issue with IntelliJ IDEA 14.1 or just my box? Any ideas on how to fix it or where to start would be greatly appreciated.
I was having similar issue.
Do you have haxe plugin installed? Try to uninstall and try after that and it should work.

Setting up Android Bootstrap in IntelliJ

I found this open source project: Android Boostrap. However, I am having some troubles with getting it run in IntelliJ. I have followed their own instructions, but still I am running into some problems. Note that I just started using IntelliJ. I cannot even describe the errors I am getting very precisely, since I am not sure about what exactly is causing them. Here is the screenshot of what I have:
Navigating to the problem:
How do you suggest me to solve it?
Another snapshot regarding unsupported import:

Categories

Resources