
Hello dear readers. Today we will talk about a topic like Java 8 and Android. On the pros and cons, and other interesting topics.
Not a little time has passed since the release of Java 8, and on Android it appeared not so long ago. Once this story was repeated with the transition to Java 7. And here we are again in the same place.
')
And now, after
dancing with a tambourine studio settings, you finally connected Java 8 to your project.
Pros of Java 8
The main advantage is, you won’t believe, Java 8. New features are really useful, and pretty cool. These are the same lambda expressions, and references to methods, and other cool things about which you can write all day, and now about the bad.
Java 8 Cons
Java 8 has one fat minus - Jack. In order to connect a new Java to the project, you need to spend some time and so, and with Jack, Android development turns into hell.
My colorful experience
Once I decided to try what kind of beast it is. I added Java 8 to my project, and I was genuinely glad that I did it, although I had to tinker. Java 8 did not want to be friends with Dagger. But after the
sacrifice to the pagan deities, searching for the answer to the stack overflow and other honorable places - the result was a fully working attachment. Everything looked cool. And I decided for myself once and for all: Java 7 is a scrap, long live Java 8.
Less bright continuation
I decided to do my next project on the very Java 8, which I later regretted. Unlike the previous project, this one had to be done quickly and not waste time on the buildup. Nothing foreshadowed trouble, until after the next build of the attachment she crashed. It was the good old
NullPointerException
. He is still a surprise. It worked when I used to change the text in the
TextView
. So
TextView == null
. But how? Make
ButterKnife.bind(this);
I have not forgotten, so what's the matter? And why did it crash right now, because everything was ok before, and I didn’t change anything? I decided to rebuild - everything is ok again. I think: ok, that it would be dealt with sometime later. Again something changed, again build, and again NullPointerException. The only reasonable explanation was that for some good reason butterKnife didn't do a damn thing. After several rebuilds, everything returned to normal, then it crashed again, and after
another search
sacrifice in various forums, an answer was found: it turns out that such garbage is not just me, and the blame is the notorious Jack (
Even Jake Wharton himself was “warm” about him ). There was no time to understand, and I returned to the good old Java 7.
And as it turned out, not only ButterKnife had problems with Jack. Ever since I continue working on Java 7, because I think Jack is too unstable. It feels like playing roulette. That's how the rainbow light turned into a gray sadness :(