Wonder4 Life


  • 首页

  • 归档

  • 标签
Wonder4 Life

How to pair phone with the watch AVD

发表于 2018-07-09 | | 阅读次数

1) Install “Wear OS by Google” app from google play store

2) Connect the phone to the computer through USB.

3) Create a wear emulator & start it.

4) Make sure both phone & wear emulator are active by adb command:

1
2
3
4
$ adb devices
List of devices attached
XXXXXXXXXXXXXXXX device
emulator-5554 device

5) Forward the AVD’s communication port to the connected phone adb -d forward tcp:5601 tcp:5601

6) Start Wear OS app and then tap Pair with Emulator.

pair with emulator

7) And then, follow the app wizard to copy Google Account to the watch emulator.

Wonder4 Life

Dagger 注入对象的原理

发表于 2017-07-21 | | 阅读次数

这篇文章采用循序渐进的方式,分析下 Dagger 注入对象的原理,看看 Dagger 是如何完成编译时依赖注入。这里仍然采用上篇文章的例子,在 MainActivity 中 注入 Stool 对象。

阅读全文 »
Wonder4 Life

使用 Dagger 库 基础篇

发表于 2017-07-20 | | 阅读次数

Dagger 是一个依赖注入的库,采用编译时生成代码的方式实现,现在的版本是 2.11。

Dagger 涉及的概念很多,为了避免过早的陷入细节,这篇文章先通过一个例子,介绍 Dagger 库基本的 @Inject , @Component, @Module 几个知识点。

下面我们就看看如何用 Dagger 造个凳子(图片来源于 Muji 官网):

榫卯

阅读全文 »
Wonder4 Life

Github 创建项目主页

发表于 2017-05-31 | | 阅读次数

Github 除了可以创建个人主页以外,也可以创建项目主页。以下表格列出了对应的域名:

Type of GitHub Pages site Pages default domain & host location on GitHub Location of the source files for building your Pages site
User Pages site username.github.io master
Organization Pages site orgname.github.io master
Project Pages site owned by a user account username.github.io/projectname master, gh-pages, or a /docs folder on master
Project Pages site owned by an organization orgname.github.io/projectname master, gh-pages, or a /docs folder on master
阅读全文 »
Wonder4 Life

Using jadx to decompile android app

发表于 2017-05-22 | | 阅读次数

Jadx 有图形和命令行两种工具,可以从 Android Dex 和 Apk 文件中反编译出 Java 代码。

jadx-gui

阅读全文 »
Wonder4 Life

Android support libraries 版本冲突问题

发表于 2017-04-18 | | 阅读次数

今天创建新工程,在 gradle 脚本中遇到了错误提示:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.3.1, 24.0.0. Examples include com.android.support:animated-vector-drawable:25.3.1 and com.android.support:mediarouter-v7:24.0.0 more…

引入的 library 如下:

1
2
3
4
5
6
dependencies {
...
compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.google.android.gms:play-services:10.2.1'
...
}

说明 play-services 10.2.1 版本的某个子包采用了 24.0.0 版本的 appcompat-v7,产生了版本冲突。具体可以通过如下命令查询库的依赖报告:

由于gradle plugin version: 3.0 用 implementation 或 api 取代了 compile ,查询命令如下:

1
./gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath
阅读全文 »
Wonder4 Life

译 Dagger: dependency injection on Android (Part 2)

发表于 2017-04-13 | | 阅读次数

If you read first post about dependency injection, you will probably be looking for some real code. There are some beautiful examples about coffee makers at Dagger page, and an awesome model project by Jake Wharton for more experienced users. But we need something easier and coffee is not our main business model, so this article will provide an example where we are injecting some simple components to let us understand the basics.

Source code explained here can be found at DaggerExample repository at Github.

如果你阅读了有关依赖注入的第一篇文章,你可能在寻找相应的代码。这有一些漂亮的例子,如 Dagger 官方示例 coffee makers,以及一个很棒的适合更加有经验用户的例子 model project by Jake Wharton。但我们需要更简单的例子,并且 coffee 并不是我们的主营业务。因此,本文会提供一个示例,注入一些简单的组件,理解基础。

源码在 DaggerExample repository at Github.

阅读全文 »
Wonder4 Life

译 Dependency injection on Android: Dagger(Part 1)

发表于 2017-04-13 | | 阅读次数

On this new series I will explain what dependency injection is, what its main purpose is and how to use it on an Android project by using Dagger, the best know implementation designed with Android in mind.

It will be a follow-up from my previous post about MVP for Android, because I know some of you are quite interested in see them implemented in the same project, and I think they work quite well together.

This first part is going to be only a little theory to settle the basis. It’s important to understand what it is and why it exists, because if not we will think the benefits are not enough for the effort.

在这个新的系列文章中我将解释什么是依赖注入,它的主要目的是什么以及如何在 Android 项目中使用 Dagger,一个最著名的 Android 版本的实现。

本文是 MVP for Android 的后续文章,因为我知道你们中有一部分人对在项目中整合它们很感兴趣,而且我认为它们可以很好的协作。

第一部分将仅介绍一些理论来奠定基础。理解它是什么以及为什么存在是很重要的,因为如果我们不认为它有足够多的益处,也不会有足够的动力去使用它。

阅读全文 »
Wonder4 Life

在 Hexo 中使用本地图片

发表于 2017-02-20 | | 阅读次数

博客配图采用图床是个不错的解决办法,不过还要注册账号,免费的又担心遇到问题。所以这里想尝试在 Hexo 中使用本地图片。

使用本地图片最舒服的方式还是编辑器引用相对路径,同时可以在生成网页时自动匹配。上网搜到了解决方案:

CodeFalling/hexo-asset-image

阅读全文 »
Wonder4 Life

采用 pip 方式安装 TensorFlow

发表于 2017-02-13 | | 阅读次数

安装 TensorFlow(pip方式)

安装 python3 和 pip3

首先,需要安装 python 和 pip:

1
2
3
# Ubuntu/Linux 64-bit
$ sudo apt-get install python-pip python-dev
$ sudo apt-get install python3-pip

这时会有 python 2.7 和 3.5 共存,默认版本为 2.7,为了默认使用 python 3.5 及 pip3,可以在 .bash_profile 中增加如下语句进行重命名:

1
2
alias python=/usr/bin/python3
alias pip=/usr/bin/pip3

用如下命令验证版本:

1
2
3
4
$ python --version
Python 3.5.2
$ pip --version
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)

取消重命名,只需要执行 unalias:

1
2
$ unalias python
$ unalias pip
阅读全文 »
12
Rivendell

Rivendell

11 日志
7 标签
© 2018 Rivendell
由 Hexo 强力驱动
主题 - NexT.Pisces