download:Android application building practice + principle in detail

Based on the latest construction tool chain, this course takes the development and release of a page routing framework as the main line, combines actual practice with theory, and deeply learns Gradle’s popular compile-time annotation processing, bytecode peg and other advanced technologies, leading everyone to systematically master the knowledge of Android application construction and improve the development efficiency.

支那

The technical requirements

Android Basics

Basic use of Android Studio and other development tools

Environmental parameters

Technical Language:

Groovy/Java/Kotlin

Android: 10.0+ Development platform: Mac

IDE: Android Studio 4.0+Gradle: 6.0+

Android Gradle Plugin: 4.1.0 +

支那

      1. package main

      2. import (

      3. // “fmt”

      4. “os”

      5. “flag” // command line option parser

      6. )

      7. Var nFlag = flag.Bool(“n”, true, “can newline end “)

      8. func main() {

      9. flag.Parse(); // Parse command line options

      10. s := “”;

      11. for i := 0; i < flag.NArg(); i++ {

      12. if i > 0 {

      13. S += “” // Separate words with Spaces

      14. }

      15. s += flag.Arg(i)

      16. }

      17. If *nFlag {// Newline or not

      18. s += “\n”

      19. }

      20. // fmt.Println(flag.Args());

      21. os.Stdout.WriteString(s);

      22. }

      23. // results in cmd:

      24. > go run hello.go -n=false good morning

      25. good morning

      26. > go run hello.go -n=true good morning

      27. good moring

      28. > go run hello.go good morning

      29. good moring

      30. >

      This is a program derived from the above problem, how to handle command-line arguments. Unlike c/ C ++/ Java with arguments that can handle command-line arguments, go has its own way.

      The flag package serves as the disposal command line argument. Echo echo echo echo echo echo echo echo echo echo echo echo Acquiescence with line breaks.

      Flag. Bool gets the -n option, true/false? Use flag.parse to retrieve these options and parameters before applying them. Then you can either process the parameters with the flag.args () fragment, or stop the process with flag.narg () and flag.arg (I) — one for length and one for detail values.

      Stdout.WriteString can also be used to stop output using FMT functions.

    1. Fibonacci closure

      1. package main

      2. // fib returns a function that returns

      3. // successive Fibonacci numbers.

      4. func fib() func() int {

      5. a, b := 0, 1

      6. return func() int {

      7. a, b = b, a+b

      8. return a

      9. }

      10. }

      11. func main() {

      12. f := fib()

      13. // Function calls are evaluated left-to-right.

      14. println(f(), f(), f(), f(), f())

      15. }

      What is fiboracci’s relationship with closures? The Fibonacci sequence is a well-known sequence: 1, 1, 2, 3, 5, 8, 13… ; Every number from the third is the sum of the first two numbers, and the first two numbers are both 1. Common c, C ++ and other languages, e will use a loop to iterate; Go can, of course, but the closure technique used here is very clever.

      Fib is a function that has two parts, a and B, and the return value is a function that uses a and B; The return value is a function that is now supported or ready to be supported in many languages, such as javascript, F#, etc. According to the tradition of C language, after the function is called, some (automatic) variables A and B are destroyed and cannot be used; But what happens in GO when two partial/temporary variables in fib are constantly being used in the function that fib returns — this practice is closure? It will prolong the lifetime of these two variables, which means that they are used as long as the returned function is still used; So, the first call to F and the second call to F use these two variables, and the values of these two variables are constantly changing. Each time F is called, the a returned by F is a Fibonacci number, and the number of Fibonacci numbers returned by several calls.

      Func is a function, and we write the function name, the parameter, and the return type of the function. Function names, if any, are anonymous!

    2. Peano integers

      1. // Peano integers are represented by a linked

      2. // list whose nodes contain no data

      3. // (the nodes are the data).

      4. / / en.wikipedia.org/wiki/Peano_…

      5. // This program demonstrates the power of Go’s

      6. // segmented stacks when doing massively

      7. // recursive computations.

      8. package main

      9. import “fmt”

      10. // Number is a pointer to a Number

      11. type Number *Number

      12. // The arithmetic value of a Number is the

      13. // count of the nodes comprising the list.

      14. // (See the count function below.)

      15. // ————————————-

      16. // Peano primitives

      17. func zero() *Number {

      18. return nil

      19. }

      20. func isZero(x *Number) bool {

      21. return x == nil

      22. }

      23. func add1(x *Number) *Number {

      24. e := new(Number)

      25. *e = x

      26. return e

      27. }

      28. func sub1(x *Number) *Number {

      29. return *x

      30. }

      31. func add(x, y *Number) *Number {

      32. if isZero(y) {

      33. return x

      34. }

      35. return add(add1(x), sub1(y))

      36. }