Android¶
Gradle¶
APK 证书¶
keytool -genkeypair -alias serverkey -keypass 111111 -storepass 111111 \
-dname "C=CN,ST=GD,L=SZ,O=vihoo,OU=dev,CN=vihoo.com" \
-keyalg RSA -keysize 2048 -validity 3650 -keystore server.keystore
android{
...
...
signingConfigs {
myrelease {
storeFile file( System.getProperty("user.home") + "/.android/debug.keystore")
keyAlias "AndroidDebugKey"
storePassword "android"
keyPassword "android"
}
}
buildTypes {
release {
signingConfig signingConfigs.myrelease
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.myrelease
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
学习资料¶
sdkmanager¶
$ sdkmanager --list
$ sdkmanager 'extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha8'
adbshell¶
# 打开Android Terminal Emulatror后,输入如下的内容:
su -root # 切换到root
setprop service.adb.tcp.port 5555
stop adbd
start adbd
$ ./gradlew assembleRelease
$ ./gradlew assembleDebug
$ adb install app/build/outputs/apk/release/app-release.apk
$ adb shell pm list package # list all installed packages
$ adb shell pm uninstall com.example.client
$ adb shell am start com.example.client/com.example.client.MainActivity # start
$ adb shell am start -n com.example.client/com.example.client.MainActivity # restart
adb connect 192.168.0.105
adb devices
adb --help
adb install dangbeimarket_4.3.5_277_yunji.apk
- remote-debugging-with-android-emulator
$ git clone https://github.com/guolindev/booksource
搭建环境¶
Android studio gradle 无法获取 pom文件¶
- 取消国外代理,改为国内
- gradle 设置代理
Download¶
- 官方下载地址
- https://developer.android.com/studio/index.html
- google developers
- https://developers.google.cn/
- api doc
- http://www.embeddedlinux.org.cn/androidapi/
required¶
$ sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
Android SDK 在线更新镜像服务器资源¶
- 中国科学院开源协会镜像站地址:
- IPV4/IPV6: http://mirrors.opencas.cn 端口:80
- IPV4/IPV6: http://mirrors.opencas.org 端口:80
- IPV4/IPV6: http://mirrors.opencas.ac.cn 端口:80
- 大连东软信息学院镜像服务器地址:
- http://mirrors.neusoft.edu.cn 端口:80
- 北京化工大学镜像服务器地址:
- IPv4: http://ubuntu.buct.edu.cn/ 端口:80
- IPv4: http://ubuntu.buct.cn/ 端口:80
- IPv6: http://ubuntu.buct6.edu.cn/ 端口:80
- 上海GDG镜像服务器地址:
- http://sdk.gdgshanghai.com 端口:8000
$HOME/.gradle/wrapper/dists/gradle-4.0-milestone-1-all/2rnr7rhi2zsmkxo9re7615fy6/gradle-4.0-milestone-1
/home/jxm/.gradle/wrapper/dists/gradle-4.0-milestone-1-all/2rnr7rhi2zsmkxo9re7615fy6/gradle-4.0-milestone-1-all.zip
移动UI框架¶
常见问题¶
$ sudo adb kill-server
$ sudo adb start-server
#then connect your device turn Debugging on and type
$ adb devices