r/androiddev • • Nov 23 '15

Android Studio 2.0 Preview | Android Developers Blog

http://android-developers.blogspot.in/2015/11/android-studio-20-preview.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+blogspot/hsDu+(Android+Developers+Blog)
278 Upvotes

119 comments sorted by

57

u/stoyicker Nov 23 '15

I'm still sitting here waiting for the Gradle interpreter to stop asking me to pointless 'Sync now' every time.

7

u/benol Android Studio Team Nov 23 '15

Can you explain when AS asks you that without a good reason?

21

u/stoyicker Nov 23 '15

Add a comment.

Or delete a comment.

Or do whatever and then ctrl-z it.

8

u/droidxav Android Studio Team Nov 23 '15

yes, we don't pre-parse the build file to see if the change you made requires a sync, so if you do something like this it will be pointless.

4

u/geecko Nov 23 '15

Any changes planned regarding that?

14

u/droidxav Android Studio Team Nov 23 '15

It's hard to do it how I describe (pre-parse the build file). We want to get to a point where sync is very, very fast so that we can do it in the background all the time (when the build files are changed).

6

u/[deleted] Nov 24 '15

remove all comments | remove all useless spaces | md5 it. If the md5 of that hasn't changed there is no need for a sync. This will catch 90% of the time when a sync is not required, because usually it's just adding comments, properly indenting and etc.. that a sync shouldn't happen.

0

u/[deleted] Nov 24 '15

[deleted]

6

u/cypressious Nov 24 '15

To be fair, reordering lines can change the semantics of a build.

-1

u/geecko Nov 23 '15

Ok, merci ! J'attends de voir ça.

18

u/Voshond Nov 23 '15

Is the new emulator part of this canary release?

9

u/tnorbye Android Studio Team Nov 23 '15

No, not in the first preview release.

3

u/asarazan Capital One: Mobile Lead Nov 23 '15

I don't think so. I'm completely up-to-date and the emulator is still slow and sparse.

3

u/[deleted] Nov 24 '15

Yeah, and it doesn't resize, which was pretty straightforward in the video. I guess it comes out later.

33

u/jopforodee Nov 23 '15

I feel sorry for JRebel

27

u/cypressious Nov 23 '15 edited Nov 23 '15

Don't. The feature is far from complete right now.

Here are some code changes that Instant Run does not currently support:

  • Add/remove/change annotations

  • Add/remove/change an instance field

  • Add/remove/change a static field

  • Add/remove a static method signature

  • Change a static method signature

  • Add/remove an instance method

  • Change an instance method signature

  • Changing which parent class the current class inherits from

  • Change the list of implemented interfaces

  • Changing static initializer of a class(edited)

via http://tools.android.com/tech-docs/instant-run

13

u/QuestionsEverythang Nov 24 '15

Still, for it being a free feature, it's a hell of a lot better than paying over $100/year for features that may eventually come standard in AS.

1

u/[deleted] Dec 04 '15

More like $475/year now.

4

u/geecko Nov 23 '15

You should remove those asterisks, they break the hyperlink.

1

u/pfn0 Nov 24 '15

ouch, protify practically supports all of that

2

u/cypressious Nov 24 '15

Does it support running without SBT?

1

u/pfn0 Nov 24 '15

Sbt is a requirement, however, it imports gradle builds transparently.

9

u/greysonp Nov 23 '15

Normally I would, but I felt pretty burned when they announced that the plugin is not only going to cost money, but a lot of money. I'm all about supporting people, but $135/year for individual use is bit crazy.

13

u/vinng86 Nov 23 '15

Eh, that's like $11 a month. It's not that crazy if it lets you push code out faster and you end up making up more than what you spend on JRebel.

15

u/s73v3r Nov 23 '15

I fail to see how wanting to make a living off your hard work is "burning" anyone.

8

u/greysonp Nov 23 '15

You're right, I guess I'm just spoiled by how pretty much every android library out there is free and open source. Still, I get that they're trying to make money, but typically you charge for businesses and make individual use free/low-cost. I mean they're perfectly justified to charge for it, I just think it'll result in lower usage.

4

u/zootam Nov 23 '15

if its a quality product and truly saves you time per day, and you value your time more than $135 per year, whats the problem?

1

u/asmx85 Nov 24 '15

"Better" alternatives. But i am not sure if he was aware of that at the time of writing.

3

u/asmx85 Nov 23 '15

I am on the same side here. I tryed the evaluation and i was not that much amused. The main problem for me was the huge initial loading time of its wrapper thing. And every time i crashed my app during development i need it to restart. Or if i changed devices, what i do a lot. That was not a huge impact it still was saving me a lot of time but it was not what i expected cuz the "normal" cycle was still about >10 sec. or more.

I searched for alternatives, there was this thing from facebook (dunno the name anymore) but it was unusable for small projects. I had it running, but that cost me half a day and i dare to use it on existing projects. there are a few other projects out there i'd tried. but what i really sicked with was Layoutcast *1 it is really not stable and i now use it from the commandline (its a python script) and a forked version *2 but after you get it to run 2 sec. after you command it to run its displayed an the phone. very impressive.

i will still use it for the time beeing ( i guess until the stable 2.0 of AS is available and if it is as fast as layoutcast ) and it is already – for me personally but i invested quite some time to overcome the instability – better than jrebel.

*1 https://github.com/mmin18/LayoutCast
*2 https://github.com/onolox/LayoutCast

2

u/pfn0 Nov 23 '15

protify is faster and more stable than layoutcast.

1

u/asmx85 Nov 24 '15

I tried that one, did not work for me, i got strange scala errors. Did not seem to worth spending more time until layoutcast worked. Besides that, there is no gain to be faster than 2 Sec.

1

u/pfn0 Nov 24 '15

It's worth it

1

u/asmx85 Nov 24 '15

I'll give a try, next time i have time for such things :) i was not saying its worthless. But at the time one fast deployment tool worked, the journey was done for me that day.

0

u/[deleted] Nov 23 '15

[deleted]

2

u/pfn0 Nov 23 '15

protify is free, and handles kotlin, retrolambda, and large projects much better than jrebel does.

1

u/greysonp Nov 23 '15

Nothing on their pricing page implies that. You could probably email them directly if you think you have a special case.

4

u/[deleted] Nov 23 '15

I feel sorry for Genymotion.

1

u/allholy1 Nov 23 '15

why?

2

u/asarazan Capital One: Mobile Lead Nov 23 '15

evidently they've introduced a lot of features to the emulator, but I can't find any literature about it.

1

u/[deleted] Nov 23 '15

What is JRebel and what is Genymotion?

Can someone ELI5 for non-developers?

5

u/[deleted] Nov 23 '15

JRebel allows hot reloading of Java bytecode. So you don't need to recompile your entire project.

Genymotion runs Android VMs and integrates well with Android Studio. It is a lot faster than the the Android Emulator that ships with Android Studio prior to this.

5

u/tauntz Nov 23 '15

Not only bytecode but also resources.

Instant Run does basically the same thing that JRebel does but seems to be less capable in terms of supported features. We'll see if it catches up with JRebel in the future..

1

u/Iron_Maiden_666 CM11 Nov 24 '15

The android emulator with kvm enabled is pretty fast. It sucks in Windows, but on Linux it's a beast.

1

u/boomchaos Nov 24 '15

What's kvm?

2

u/SergeantFTC Nov 24 '15

A virtualization tool for Linux.

12

u/-manabreak Nov 23 '15

The instant run feature seems to be a bit sporadic still. Code changes are updated, but XML resources do not seem to change like they should. I'm testing this by changing a string in strings.xml and sometimes it doesn't see any changes ("Instant Run:: No Changes."), and sometimes it fully re-deploys the app. Haven't had a single occurrence of the text hot-swap working.

4

u/MaliciousBoy Nov 23 '15

changing string resources is not yet compatible with Instant Run, according to the website

2

u/nhaarman Nov 23 '15

The feature doesn't seem to work here. The setting is enabled, and I've updated the gradle plugin. Whenever I click the 'run' button, the app is killed, gradle builds and reinstalls the APK. Did I miss something?

2

u/kaeawc Nov 23 '15

Seeing the same thing here.

2

u/dzjay Nov 23 '15

You need sdk build-tools 23.0.2, and update the buildToolsVersion value in build.gradle.

1

u/aerodynamix Nov 23 '15

Where is the setting?

1

u/peduxe Nov 24 '15 edited Nov 24 '15

Yep, it kills the app but does indeed update, like 15 seconds after. At least I no longer have my code changes not being visible in the app.

edit: after rebuilding and cleaning the project it does work now :)

17

u/pakoito Nov 23 '15

Hot reload? Neat! The iteration cycles are getting smaller with the latest tooling changes.

5

u/jackhexen konmik.com Nov 23 '15

I've got a significant assembly step slowdown with the release of 1.5

3

u/tnorbye Android Studio Team Nov 23 '15

Make sure you're using the latest build tools (23.0.2).

1

u/jackhexen konmik.com Nov 24 '15

I use them.

0

u/asarazan Capital One: Mobile Lead Nov 23 '15

Damn it.

7

u/scanarch Nov 23 '15

JRebel doesn't really cope with Retrolambda. It's probably gonna be the same case for this feature.

Looking forward to Kotlin support!

2

u/pfn0 Nov 23 '15

protify supports both kotlin and retrolambda

1

u/scanarch Nov 24 '15

Never heard about this one. Thanks!

7

u/dhantana 🖖Search for Reddit goo.gl/zEL1b7 Nov 23 '15

So...is genymotion in trouble because of the new emulators?

5

u/[deleted] Nov 23 '15

Only if they don't offer anything to compete.

9

u/imkosh FastHub for GitHub Nov 23 '15

finally, the only thing that is missing so far is the search functionality for Vector asset.

4

u/Phreakhead Nov 24 '15

I just wish they supported actual SVGs, and not some proprietary format that no design tool supports.

3

u/timusus ♪ Shuttle Developer Nov 23 '15

The only thing

There's always more only things.

0

u/[deleted] Nov 23 '15

[deleted]

13

u/Fiskepudding Nov 23 '15

The irony of this being produced by the world's largest search engine company...

1

u/imkosh FastHub for GitHub Nov 24 '15 edited Nov 24 '15

same here, i reported an issue about it, you guys could star it so they take it serious, i even post it on Tor and Jalal wall on G+ to take care* of that. https://code.google.com/p/android/issues/detail?id=194947

7

u/theheatofthewinter Nov 23 '15

Can someone using the canary channel build post some impressions? :)

1

u/momodao Nov 24 '15

nary

I tried it on 2 of my projects so far, 1 which is pretty simple with very little dependencies, compile time drops to <5s. On the other project, it usually compiles >40s, now it drops to 10+s. So it feels pretty impressive. Note that my comparison might not be fair because I might change different files but at the very least I can feel a significant enough improvement in the build time.

1

u/kaeawc Nov 23 '15

So far it hasn't built instantly, however we are close to the multidex limit (63k) and as Xav has pointed out it might not build. I otherwise have 1-5 second builds when running unit tests, ~20 seconds to build debug and have it open in Genymotion.

9

u/pjmlp Nov 23 '15

Nice, but I got disappointed:

  • Still no Renderscript debugging/editing capabilities

  • Still no shader editing or debugging support

  • Still no proper templates for NDK projects

  • No word on Java 7+ support

None of the announcements I was expecting. :(

2

u/[deleted] Nov 24 '15

Still no proper templates for NDK projects

I can't believe there is no mention of this. NDK is one of the top 3 requested features and all google does is say fuck you NDK bastards. AS 2.0 can't even do NDK yet. If they don't fix that I'll be stuck on 1.5.

0

u/jafu888 Nov 23 '15

Using RenderScript in Android Studio is pretty easy https://www.youtube.com/watch?v=kybZnFQh6fE

But RenderScript Debugging capabilities

2

u/pjmlp Nov 23 '15

For that I could use Notepad++.

It doesn't offer any editing support for intelisense, linting or any other goodies that Java enjoys.

3

u/_y2b_ Nov 23 '15

Anyone know which version of IntelliJ this is based on?

16

u/tnorbye Android Studio Team Nov 23 '15

It's based on 15.0.2 EAP, the exact tag is idea/143.747.5

1

u/MrBIMC Nov 23 '15

Normal fonts on macs are back! woooo!

-6

u/[deleted] Nov 23 '15

14.3

11

u/droidxav Android Studio Team Nov 23 '15

Actually Studio 2.0 is based on IntelliJ 15

1

u/peduxe Nov 23 '15

Finally the crisp fonts are gone on Linux!

1

u/trtryt Nov 24 '15

Is that only for HiDPI, in the comments here they are still working on

You might have heard that we already implemented sub-pixel AA for Mac OS X. Linux is our next big goal.

http://blog.jetbrains.com/idea/2015/07/intellij-idea-15-eap-comes-with-true-hidpi-support-for-windows-and-linux/

1

u/peduxe Nov 24 '15

I'm not aware of that but I saw my issue was solved on IntelliJ 15. There were some hacks to fix it, by downloading a modified Java SDK and what not.

1

u/trtryt Nov 24 '15

So on 15 you still had to download the modified OpenJDK

2

u/peduxe Nov 24 '15

So on 15

No, 14 and prior.

5

u/jackhexen konmik.com Nov 23 '15

The box answer?

5

u/sambarboza Nov 23 '15

It seems that the Instant Run feature does not work with Kotlin. My app is crashing on startup when built with the 2.0.0-alpha gradle plugin. http://stackoverflow.com/questions/33880943/error-running-android-written-in-kotlin-project-compiled-with-gradle2-0-0-alph

3

u/peduxe Nov 24 '15 edited Nov 24 '15

Is not working for me with neither (Java or Kotlin), it just deploys the apk normally. But I noticed it's got a damn lot faster now.

edit: after unninstalling apk, rebuilding and cleaning the project it does work now :)

1

u/hannesstruss Nov 24 '15

Is it working as in not crashing anymore, or actually doing instant reloading of Kotlin code?

1

u/peduxe Nov 24 '15

It didn't crash for me, just that after rebuilding Instant Run works with a Kotlin project. Code changes aren't affected but it did work with resources.

2

u/Rican7 Nov 23 '15

From the TechCrunch article:

Cuthbertson politely refused to tell us how exactly Instant Run works, but promised that Google will detail the technology behind this feature in the future.

I wonder if the technology behind this is at all related to the new app streaming tech that they've recently released (in beta).

This is all very impressive.

5

u/ZakTaccardi Android Developer Nov 23 '15

Highly doubt that

2

u/mozdev Nov 24 '15

It works probably the same way as the facebook build tool buck... with exopackage enabled:

https://buckbuild.com/article/exopackage.html

Which is a tiny c program that receives the jar / apk files over TCP and executes them.

2

u/tnorbye Android Studio Team Nov 25 '15

We got into a lot of technical detail in our talk about it at the Android dev summit: https://www.youtube.com/watch?v=fs0eira2pRY

1

u/Saketme Nov 24 '15

I'm unable to run my project on Android Studio 2.0 :(

Here's the gist: https://gist.github.com/Saketme/20da42adc53cc09bba9d

Can anyone please help? It was running fine on the old version.

1

u/ZakTaccardi Android Developer Nov 24 '15

Any confirmations for support or lack of support for Retrolambda?

1

u/zeus180 Nov 23 '15

Instant Run. Bliss!

1

u/stusmall Nov 23 '15

Has anyone got the GPU profiling to work? I don't see it in the SDK manager

1

u/AmberVaid Nov 23 '15

instant run works on device too. this is the best feature for me.

1

u/lomoeffect Nov 23 '15

Wow. Gonna make developing so much easier - seriously impressive. Excellent job!

0

u/neoranga Nov 23 '15

I love developing and testing on Android so I can't wait to get my hands on that emulator, I have been waiting for a good emulator for years and my bar is set higher than genymotion, is set at iOS emulator level.

Only the Android fairy knows if my wish will come true...

0

u/jug6ernaut Nov 23 '15 edited Nov 24 '15

Anyone else having issues with this starting up on OSX? The loading bar gets to the end and just sits there...

Not sure where the logs are for this to see whats going on. FYI this is with new preferences, non imported.

Edit: logs show it is starting up successfully... Not sure what's going on.

2

u/Xylon- Nov 24 '15

Exactly the same here, but on Windows.

1

u/jug6ernaut Nov 24 '15

I have tried clearing all the Android Studios files so that it starts clean. Haven't made any progress, still freezes on the very end.

Oddly the log file says that it started up successfully.

-1

u/trtryt Nov 23 '15

Wow they actually fixed their shitty emulator

0

u/[deleted] Nov 23 '15

[deleted]

18

u/droidxav Android Studio Team Nov 23 '15

I just edited that line to be more clear.

The issue is that we have to include a bit of code in your app to handle the deployment and hotswap, so if your app is using legacy multi-dex, and your main dex file is very close to the 65K limit, then you may have a problem.

If you're using 21+ multi-dex, or if you have room in your main dex file, it'll work. We are looking at ways to improve this situation.

2

u/halfjew22 Nov 23 '15 edited Nov 23 '15

I'm getting an error when building my project. Grade updated, build tools at 23.0.2, and haven't changed anything else in my project. Error is as follows:

Error:Execution failed for task ':mobile:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:     org.gradle.process.internal.ExecException: Process 'command     '/Library/Java/JavaVirtualMachines/jdk1.8/Contents/Home/bin/java'' finished with non-zero exit value 2

Edit: Fixed with a clean of the project.

2

u/eric_fri Nov 24 '15

I'm getting the same error, only a clean has not fixed it. Gradle built from the command line no problem, but Studio wouldn't. The only thing I could do that would result in a successful build is roll back the Gradle plugin, thus disabling the new Instant feature. :(

1

u/nrs_sowrabh Nov 24 '15

For me clean build fixes it but again incremental build fails with the same error defeating the purpose of instant run.

1

u/jtgilkeson Android Development Consultant Nov 23 '15 edited Nov 23 '15

Will the hotswap logic eventually be smart enough to look at the device that you are pushing to (since it now prompts for that at the start of a build), or will you continue to have to set a minimumSdk to 21+?

1

u/droidxav Android Studio Team Nov 23 '15

Absolutely, though it's not specific to hostswap.

If you plan to deploy to a 21+ device from Studio, and have multi-dex enabled, we should be able to build with native multi-dex rather than legacy multi-dex. It's much faster to build that way.

2

u/stud-d Nov 23 '15

Any reason why changing dp of a view doesn't say it's supported but it works? /u/droidxav docs say "Add, remove, or change a string resource" but nothing about width, but I tried and it works. Or does ALL xml changes work?

1

u/droidxav Android Studio Team Nov 24 '15

As long as you don't change the res IDs, it should work.

1

u/badlogicgames Nov 24 '15

Related question: since Instant run partially relies on IDE APIs, what are the chances of it being available to IntelliJ IDEA CE/Ultimate users?

1

u/Cephas00 Nov 24 '15

I'd assume pretty likely. They seem to port everything back to IDEA pretty quickly.

0

u/kokeroulis Nov 23 '15

So as it has been mentioned a lot of times here, just use min SDK 21 for debug builds.

0

u/BlueCoug Nov 23 '15

Will it work for apps using multidex?

2

u/kaeawc Nov 23 '15

If you're on SDK 21+