Jul 26, 2017 |
Comments Off on maytham-ɯɐɥʇʎɐɯ on How to solve Instant Run on Android Studio Canary 5, 6 and 7

I solved this way:

What I did is creating an empty new project in Android Studio 3.0 Canary 7, it does not have this behavior. I compared the new empty project default build.gradle (Module: app) with my existing project that has the mentioned problem.

Off course this can differs from case to case, but in my case, I used a variable to update versionName and it worked previously with out any issues, but not on Andriod Studio 3. Therefore I corrected the line, Sync and Rebuild the problem was gone.

All depends on how you want to implement your solution at the end. Regarding different between main and App trait please read more.

Thx to @tzachzohar for following addition:

In Scala, just like in Java, only a static main method (with appropriate argument and return types) can serve as a program’s entry point. For convenience, IntelliJ IDEA provides a Scala Worksheet as a way to easily test your code, but that’s no magic either – it’s a just nice wrapper – behind the scenes, a worksheet has its own main method calling your code.

I am not sure why you have a loop for your arguments but correcting the argument number would solved the problem in your question, that said you are not using port number variable and your code logic can be improved a bit.