Skip to main content

7 posts tagged with "android"

View All Tags

· One min read

Gradle 默认使用 ~/.gradle 目录存放资源, 通过修改环境变量 GRADLE_USER_HOME 可以修改默认目录:

~/.bashrc
export GRADLE_USER_HOME="/dta/programs/gradle"

使用阿里云镜像

创建文件 $GRADLE_USER_HOME/init.gradle, 内容如下:

allprojects{
repositories {
def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/public'
def ALIYUN_JCENTER_URL = 'https://maven.aliyun.com/repository/public'
def ALIYUN_GOOGLE_URL = 'https://maven.aliyun.com/repository/google'
def ALIYUN_GRADLE_PLUGIN_URL = 'https://maven.aliyun.com/repository/gradle-plugin'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
remove repo
}
if (url.startsWith('https://dl.google.com/dl/android/maven2/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_GOOGLE_URL."
remove repo
}
if (url.startsWith('https://plugins.gradle.org/m2/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_GRADLE_PLUGIN_URL."
remove repo
}
}
}
maven { url ALIYUN_REPOSITORY_URL }
maven { url ALIYUN_JCENTER_URL }
maven { url ALIYUN_GOOGLE_URL }
maven { url ALIYUN_GRADLE_PLUGIN_URL }
}
}

· One min read
Alan

Flutter远程无线调试 zAndroid App:

  1. 手机号电脑要在同一无线网络(SSID)
  2. 手机开启开发者模式(一般是连续点击Android版本号或者MIUI版本号),
  3. 进入开发者选项里, 开启 Wireless debugging 并进入
  4. 点击 Pair device with pairing code, 生成一个pair code, 然后电脑上执行 adb pair [host]:[port] [pair code] 连接设备.(adb命令位于 android sdk 的 platform-tools 文件夹)
  5. 继续执行 adb connect [host]:[port], 这里的hostportWireless debugging 设置里的 IP address & Port
  6. 然后执行 flutter devices 就可以看到连上 android 设备.

参考 Set Up Device for Development