cannot find Gradle Tasks in android studio - android-studio

I am a beginner level programmer. What I need is the sha-1 key of my project, but the problem is that my gradle button is not showing any tasks. You can see here. If I use this gradle build tasks, it shows this. Please tell me what can I do to get my sha-1 key?

Related

Validating Subversion Android Studio Project Build: New Project from SVN

Given an existing Android Studio (4.0.1) project that builds and deploys properly and that has an associated SVN repository, I would like to create a separate Android Studio project and get that to also build properly. The purpose is to 1) Prove that the SVN repository is complete (has everything needed to get a build working), 2) Document the steps required to get this Android Studio project out of SVN and building.
Selecting Get from Version Control from Android Studio's welcome screen, I can specify the SVN repository and checkout:
Take the default/latest format for SVN:
And indicate I'd like to make a project out of the contents of the SVN repository:
Then I'm presented with an option that I'm unsure how to answer:
I have tried them all, none successfully. Rather than go into the details of each here, I would like to learn about which option makes sense in which situation.
The original project was created 5 or more years ago with Android Studio's 'start a new project' wizard. I've use Android Studio's default build stuff all along, and upgraded Android Studio and the various plug-ins when nagged sufficiently. I'm not sure what the important build artifacts are (or artifacts critical to a clean import are), and if those artifacts are indeed in the SVN repository and up to date. I can copy the project in the file system and rename things to get it to build, but creating another instance is not the question; the source must be exclusively the SVN repository.
I'm eager to make this question complete, so please do me the favor of specific criticism in the comments so I may improve the question or remove it, as needed.
The optimal person to answer this question would know much more about how Android Studio builds work than I do. I have strictly "cookbook" level knowledge. So without significant study, I am unable to validate intricacies of the process without more knowledgeable people to help.
The last Import Project dialog from this SO question only appears if the contents pulled from SVN are not a complete project.
In other words, if what gets pulled is a complete project, the project just opens, without having to go through any other questions and/or selections. Otherwise, other logic takes over and Android Studio tries to create a legit project for you from the bits it finds.
The solution is to make sure that the check-in from the original working project is complete, including gradle files. If Android Studio is set to view the "Android" artifact view, then everything in the list should display in the VCS "included in source control" and "checked-in" font color.

Is it possible to make Android Studio use a specific key store when building debug APK?

I do not want Android Studio to use the (automatically created) debug.keystore, instead I want to use my release keystore. The reason for this is that Push Notifications do not work when the APK is signed with the debug key.
I have googled, but I cannot find a way.
The change you want is in your build.gradle, not in Android studio itself, per-se. You can configure the signing keystore using Android Studio, but under the hood your build.gradle will be edited by the IDE. The documentation is available here.
The section on securing your key describes how to add this into your build.gradle in a secure/safe way, assuming you don't want your signing details checked into version control.

Does Intellij Idea have instant run?

It is some time now since I first heard about instant run in Android Studio 2.0. Is it ever coming to IntelliJ Idea? I have 2016.1.2 and still nothing. I can imagine it can speed up development. I am still tearing my hair every time I press run...
Couldn't find any valuable information about this online. All what google finds is just "IntelliJ and Android Studio is made on the same code base" I guess it is more complicated than that.
Seems like it's going to be released in Intellij 2016.2
Quoting 2016.2 EAP Release Notes:
Android
Android Studio 2.0 features.
Edit:
Looks like it was eventually released and made production ready in Intellij 2017.1
Quoting the What's New page:
Instant run
This release adds many stability and reliability improvements to
Instant Run. If you have previously disabled Instant Run, the Android
team encourages you to re-enable it.
No. From IntelliJ IDEA 2016.2 Notes:
Android
The update includes the Android Studio 2.0 features: faster Emulator, experiment GPU Debugger, faster full builds, and code generation and testing for App Indexing. Note, Instant Run is not fully-merged yet.

Android Studio Artifacts

After developing in Eclipse for several years I have switched to Android Studio since two days. Although I have read as much as possible about it I still have one big problem: I can not find the place to add, change, configure or whatever about the so called artifacts.
I have tried several ways from creating a new project from scratch to importing a complete Eclipse projects.
Although the IntelliJ documentation is clear about it, I can not find it.
The project structure in all cases only shows three parts in the structure:
SDK location, Project and app. I have searched them all but no artifacts.
Who can help me?
The artifact description is in the IntelliJ IDEA manual that is reached by selecting menu item 'Help, Help Topics' in Android Studio.
However, according to JetBrains Support the Android Studio documentation topics need to be updated and the Artifacts page should not be available in Android Studio.
See also: https://intellij-support.jetbrains.com/requests/58563

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