android devices
android devices
Emulator
If you need to refer to your host computer’s localhost, such as when you want the emulator client to contact a server running on the host, use the alias 10.0.2.2 to refer to the host computer’s loopback interface. From the emulator’s perspective, localhost (127.0.0.1) refers to its own loopback interface.
More details...
kotlin function
kotlin function
使用fun声明函数
可以有默认值, 默认值如果在左边, 传参需要加参数名使用命名参数; 默认值都在右边, 传参可以不加参数名; 重写时总是
使用基础函数的默认值, 重写时需要省略默认值.
支持命名参数, 不能使用命名参数调用Java代码
unit表示无返回, 可以省略
单表达式函数, 当返回一个单表达式时, 可以省略大括号和返回值, fun double(x: Int): Int = x * 2
vararg 可变数量参数, 最后封装成Array, 如果该参数不是最后一个, 就需要使用命名参数传递
支持spread operator (prefix the array with *): val a = arrayOf(...
kotlin builder
kotlin builder
kotlin 使用命名良好的函数和 function literals with receiver, 可以实现type-safe builder
Type-safe builders allow creating Kotlin-based domain-specific languages (DSLs)
Generating markup with Kotlin code, such as HTML or XML
Configuring routes for a web server: Ktor
fun html(init: HTML.() -> Unit): HTML {
val html = ...
ubuntu 14.04
ubuntu 14.04
// 解决没有system setting
sudo apt install ubuntu-desktop
// 解决依赖
sudo apt-get autoremove libcheese-gtk23 libcheese7
sudo apt install xserver-xorg-core xserver-xorg-video-dummy -y
sudo apt-get install --install-recommends linux-generic-lts-wily xserver-xorg-core-lts-wily xserver-xorg-lts-wily xserver-xorg-video-all-lts-wily xserver-xorg...
Android Source Code
Android Open Source Project
OHA OPEN HANDSET ALLIANCE 开放手持联盟
源代码可以用于任何合法用途, 但要加入Android生态圈提供设备, 那么需要加入Android兼容性计划.
Android编译环境推荐 ubuntu x86
macos m1 不推荐
Android Software Management
AOSP 代码管理
1 在任何特定时刻,Android 平台都有一个当前最新版本。该版本通常作为树中的一个分支。
2 设备制造商和贡献者会以当前最新版本为基础来修复错误、发布新设备、试验新功能等。
3 与此同时,Google 会根据产品的需求和目标,在内部开发下一版 Android 平台和框架。我们会与设备合作...
Android Build System
Android Build System
OTA update
over-the-air update, 不需要网络更新
lunch
aosp_arm-eng 或者 aosp_arm64-eng 创建的img适合模拟器, 不能在真实设备上工作.
andorid 系统编译如果没有指定硬件, 那么不会生成依赖硬盘的boot.img和recovery.img.
Reference
Android Build System
AOSP build instructions
Android Building
Establishing a Build Environment
Building Android
Android FileHost
TeamWin - TWR...
Kotlin Packages and imports
Kotlin Packages and imports
Package
kotlin包定义不用像JAVA那样匹配文件目录.
package org.example
fun printMessage() { /*...*/ }
class Message { /*...*/ }
// ...
定义package, 那么源码中的实体名为org.example.printMessage和org.example.Message
不定义package, 那么没有package 名
Default imports
kotlin.*
kotlin.annotation.*
kotlin.collections.*
kotlin.comparison...
Kotlin Common
Kotlin Common
支持trailing comma
dash doc supper
git clone git@github.com:mrcljx/kotlin-docset.git
sudo gem install nokogiri -v '1.7.1' -- --use-system-libraries
cd kotlin-docset
./run
git clone git@github.com:imvkmark/dash-docsets.git
npm install
cd laravel
brew install composer
composer install
php artisan kotlin download
Reference
463 post articles, 58 pages.