Android Studio Noob: Where is the compiler output? - android-studio

N.B. There are several similar questions to this (e.g., link) about earlier or alpha versions of Android Studio - my question pertains to the current version 2.1.1, and the earlier answers either don't seem to apply or are incomplete WRT my version.
I just installed the latest version of Android Studio on my PC (Win 7) and I'm learning how to use it. One thing all the other IDE's I've used (e.g., Visual Studio, Eclipse, etc) have is a window that lists the compiler errors and warnings and you can click on the items and it takes you to them in the source editor.
When I do a Project Build I get a message saying "Gradle Build finished with 3 warnings in 4s 753ms". But I don't know how to see the warnings.
How/where do I do this in Android Studio?

The Gradle Console shows you the results of your last Gradle task, which includes builds. If there are specific problems, they should show up there and in the Messages view. These views are docked by default on the bottom of your Android Studio window.

Related

Why is android studio decompiling classes from my projects when I open them?

Android Studio was automatically updated on my system to to 4.0.1, from version 3.2, however since I found that 4.0.1 had potential bugs, I installed a previous version (3.5.3) and I when opening one of my projects which is only a small simple test project and seemed to take an age loading, the last dialog, I see before it opens is
Title: "Loading Project..."
Body: "Decompiling class CountDownTimer.class
when in previous versions I haven't seen this behaviour and I cant find any "decompiler" options in Settings either and the question is Why is Android Studio decompiling my class files, by default? why would it need to? what is the rationale?

Why Are Android Studio Menus Not Working?

I have been using Android Studio for years. Very shortly after upgrading to Android Studio 3.5, the menu options have stopped working. I mean, anything under File, Edit .. all the way to Help. By "stopped working", I mean, I can use the mouse to select, and then .. nothing happens. A colleague suggested to invalidate caches. But invalidate caches itself is under the File menu, so nothing happens when it is selected.
Any ideas? Quitting and starting android studio didn't work. Rebooting didn't work. Changing the java version used to run Android Studio didn't work (it is set to be the same one that gradle is using). Even downloading and installing a fresh copy of Android Studio 3.5 didn't work -> from this, I suspect the problem is a settings problem, but WHICH settings got somehow corrupted? and that survives even with a fresh installation of Android Studio?
To find-in-path, the menu option doesn't work, whereas I can directly use the keyboard shortcut ⇧⌘F and it brings up the find window.
Am running on MacOS Mojave. Java home is /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home
Finally, Android Studio 4.0 came along, and we installed the patch to upgrade to it, and the mysterious problem went away, presumably as a result of the upgrade.

How to refresh the layout Preview pane in the Android Studio v2.2 IDE?

Older versions of Android Studio had a Refresh option in the layout preview in the IDE, but in v2.2 it has vanished. I am finding repeatedly that I update drawable bitmaps in the project with updated files, that new version is not reflected automatically, and I do not see the preview. Problems like this are so common with Android Studio, it's such an utterly infuriating IDE and so flaky, despite the speed it is advancing.
Where did the refresh option go? I can't believe I'm having to actually ask this, but maybe I missed it somewhere obvious!

Android Studio 1.3 Preview NDK support

Yesterday Google announced that native code debugging is now possible with this version of Android Studio.
https://plus.google.com/+AndroidDevelopers/posts/2Gk6yrZKV4X
I've updated to the newest build version "AI-141.1962279" and can't see any possibility of debugging native code.
I've switched to build-tools 23.0-rc1, used gradle plugin 1.3.0-beta1 but cannot set breakpoints in native code or step into JNI calls.
Is it really working?
July 10th update Android Studio Preview with NDK support is available : https://sites.google.com/a/android.com/tools/tech-docs/android-ndk-preview
Android Studio 1.3.0-Preview is indeed available through the Android Studio "Check for updates" menu.
Unfortunately, all C++ features aren't available yet in this preview. They will be available in about 2 weeks.
Source : Google IO dev tools keynote at 35:38
Android Studio 1.3 Beta Available
posted Jun 19, 2015, 11:37 AM by Tor Norbye
Android Studio 1.3 Beta is now available in the beta channel! Sorry, this build does not yet contain the C/C++ support; we are still ironing out a couple of critical issues, but we hope to be ready in the next week or two. Similarly, the vector rasterization support is also still not enabled due to various bugs.
UPDATE:
the 9th of July update contains c++ debug
http://tools.android.com/recent
Even on the Canary Channel, the latest currenlty available build is 1.2.1.1. We will simply have to wait a bit longer for 1.3. The "About Box" in Android Studio also displays the version number; check that to be sure.
"As announced at Google I/O, Android Studio 1.3 will include C/C++ support as well, but that is not included in the first couple of preview builds."
Source:
https://sites.google.com/a/android.com/tools/recent/androidstudio13preview1available
FYI:
NDK support is included from Android Studio 1.3 RC1 on. This includes editing running and debugging C and C++ code. See Android NDK Preview and experimental Gradle plugin guide.
with Android Studio 1.4 release you could debug native JNI code. Your project need to use gradle plugin com.android.model.application though.
After you create a project with JNI code in it, this Android Studio version will create a debug Configuration (mine is called app-native)
once you select this configuration, you could set breakpoint in JNI code
then run your app with android studio [it will download and start app on device]
When JNI code is launched, Android Studio will break right away. You could set more breakpoint at this moment too
Then let debugger "go" [to continue ]
Your breakpoints will get hit
The gradle model plugin examples could be found from googlesamples/android-ndk on github. There is a youtube clip called HelloJniWithAndroidStudio shows how to create a hello-jni with android studio 1.3, most steps still work for 1.4 -- it might help for build.gradle creation.
Different version of gradle mode plugin requires different gradle version:
Gradle-Model-Plugin-version 0.2.0 works with Gradle Version 2.5
Gradle-Model-Plugin-version 0.3.0-alpha3 works with Gradle version 2.6
you could find out what versions are available from the jcenter links mentioned earlier.

Does Android studio need internet connection to build project

I am using Android studio version 0.4.2 and gradle version 1.9. I have successfully installed Studio and have created multiple projects. Today when I launched Studio without internet connection,
I got this error message:
"Gradle project sync failed. Basic functionality (e.g. editing,
debugging) will not work properly" and the Event Log window shows
"Failed to refresh Gradle project < Project Name >. Connection timed
out: connect. If you are behind an HTTP proxy, please configure the
proxy settings either in IDE or Gradle."
I need to know if internet connection is mandatory for building projects using gradle.
I think gradle checks for latest version on internet and throws Connection time out error. If so, is there any workaround to disable that.
Currently Android Studio's Gradle implementation requires a fast stable network connection. For whatever reason, the developers have decided to force this requirement on users at this time. There is a setting that you should be able to use to utilize a local gradle installation, but it doesn't hold. The developers know about both the network requirement and the broken switch, but are currently prioritizing other functionality. They may remove that requirement in the 1.0 or post 1.0 time frame.
[see: https://plus.google.com/u/0/115692564989237473252/posts/LGSbniYqj3Q ]
Gradle's offline mode, isn't. It should be properly named cached mode. All that switch does is tell gradle to not try to go online and instead utilize cached copies of the various networked resources. Unfortunately that assumes that you have had (and will have again) a network connection, preferably a fast stable one. Using Android Studio (last version tested 0.5.9) with a slow/unstable network results in watching Android Studio process Gradle ( and Maven ) processes usually for 2-5 minutes, sometimes for 10 minutes or more. Also at seemingly random times when coding the IDE will lock up and the cause usually involves one or more Gradle processes that have spun up.
As a comparison, using IntelliJ IDEA 13.1 Community edition (the IDE that Android Studio is based on) I compared a default "Hello Android" IDE generated program using the Android Gradle wizard (substantially similar to the only one in Android Studio) and the Ant based Android wizard. The results were as expected. The gradle based project experienced the same painful lock up and lag that projects in Android Studio exhibited. The ant based Android project was near instantaneous. No appreciable delay once the project was created and opened. Coding caused no random lockups. Testing was done on a Windows 8.1 update1 Pro machine with a dual Athlon x2 processor, 6GB RAM, and a 6Mb/0.75Mb DSL connection. I believe that last part is most likely the issue.
Unfortunately until Android Studio removes the network requirement I feel it will be unusable to a large number of developers. That's a shame because otherwise it looks to be a marked improvement over the existing Eclipse based development environment.
For me, I had to check and then uncheck the box in
Preferences->Gradle->Offline work.
Then I got back online.
You can download the gradle distribution locally and build the project again.
To do this, edit your gradle-wrapper.properties under gradle-> wrapper in your Android project.
Edit the
distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip
to
distributionUrl=file:///home/foo/downloads/gradle-2.2.1-all.zip
So just download the file from here as mentioned in your gradle-wrapper.properties.
There's an offline mode preference in Preferences > Compiler > Gradle. If you already have your dependencies downloaded, this will generally work for you.
In Android studio version 1.5.1 I could solve this error by following steps :
1) Go to file -> Settings -> HTTP Proxy -> & select Auto detect proxy settings.
2) After that you may get Dialog to accept or reject certificate
3) Select Accept.
That's it.

Resources