小任班长 发布的文章

1.首先把我们的手机连接到电脑上。

2.在命令行里cd到我们的sdk下的 platform-tools的路径找到我们的adb命令输入 ,输入adb devices查看我们连接的设备

3.使用adb tcpip 8888 设置端口号,5555为默认端口号,也可以设置其它端口号,端口号为需要为4位数

4.拔掉我们的设备,开始无线连接 adb connect
使用adb connect 192.168.1.65:8888, 192.168.1.65为我们手机的ip地址, 其中8888是我们自己设的端口号,这个端口号要和adb tcpip 设置的端口号保持一样,如果我们没有自己设置端口号,直接adb connect192.168.1.65就行了,默认使用5555。 连接成功提示

取消连接就是 adb disconnect
adb disconnect 192.168.1.65:8888

According to the latest news from Huawei's official website, the compiler tool Ark compiler has been released. According to reports, the Ark compiler is a cross-compiler suite developed by GCC. It includes front-ends for C, C++, and Fortran, as well as libraries for these languages (such as libstdc++, libgcc, etc.). HCC runs on an X86 linux architecture server and the generated binary runs on the Aarch64 architecture server.

15390-hpyqz8grq87.png

Preparation before installation

1) Environmental requirements

The Ark compiler supports the following 64-bit operating systems.

SUSE12sp4 and above.

Ubuntu 16.04 and above.

Other glibc versions are available in Linux distributions 2.22 and above.

2) Get the package

Installing the Ark compiler requires an open source package as shown in Table 2-1.

  GCC 7.3.0 编译器源码包  https://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz
  Binutils 2.31.1 汇编器、链接器等二进制工具集源码包  https://ftp.gnu.org/gnu/binutils/binutils-2.31.1.tar.gz
  Glibc 2.29 GNU libc 库源码包 https://git.linaro.org/toolchain/glibc.git/snapshot/glibc-2.29.tar.gz
  Mpc 1.1.0 复数运算库  https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
  GNU MPFR 4.0.2 多精度浮点计算库  https://www.mpfr.org/mpfr-current/mpfr-4.0.2.tar.gz
  isl 0.21 集和线性约束范围内整数点关系的操作库  http://isl.gforge.inria.fr/isl-0.21.tar.gz

Install the HCC compiler

1) Operation steps

You can use the HCC tarball to install HCC anywhere under the current user privilege without affecting the use of other compilers.

a) Introduce the operation portal, for example, log in to the XX environment with the XX account.

b) Login HCC download address to download the compressed package

Hcc_arm64le.tar.gz

c) Copy the tarball to the directory you want to install.

The command script is as follows.

Cp hcc_arm64le.tar.gz /path/to/your/dir

d) Unzip the package.

The command script is as follows.

Tar zxvf hcc_arm64le.tar.gz

e) Set environment variables.

The environment variable command script is set as shown below.

Export PATH=/path/to/your/dir/hcc_arm64le/bin:$PATH

The build tools provided by the HCC compiler are in the =/path/to/your/dir/hcc_arm64le/bin directory.

2) Check after installation

After the HCC compiler is installed, you can run the aarch64-linux-gnu-gcc -v command to query the HCC version.

software download

Download source code:Download now

According to Huawei's official introduction, the Ark compiler is the first static compiler to completely replace the language virtual machine, completely without an interpreter. A compiler that takes into account Java development efficiency and C language runtime efficiency. Compared to the existing compilation mechanism:

  1. The Ark compiler is a static compilation method. In the existing Android system, running an application first starts the virtual machine, then reads the application code and interprets the execution one by one. It will occupy more processing resources and affect the efficiency of program execution. Of course, there are also early or runtime compilation techniques, such as AOT or JIT, that convert some of the programs into machine code and execute them directly on the CPU. However, it is still not possible to do 100% to get rid of virtual machine execution, which is the key to the current Android camp is not as good as the IOS camp.
  2. The static compilation mode of the Huawei Ark compiler can directly translate the dynamic features in the language into machine code. After the application is installed, the mobile phone can run the program at full speed, completely eliminating the drawbacks of the virtual machine and bringing about great improvement in efficiency.
  3. The Ark compiler is a compiler deployed in the development environment, and the existing compilation process mainly occurs on the mobile phone, which brings additional resource consumption.

At present, the Ark compiler is compiled and optimized for the general-purpose ARM chip architecture. In the future, the capabilities of the Kirin chip will be maximized through software and hardware co-design. At the same time, the Ark compiler supports Java standard usage, and the three-party application can be compiled directly without modifying the code. But if you want to get better performance or memory improvements, you can adjust the code structure and optimize with the Ark compiler.

如果您在编写HTML5应用,需要在JS代码中访问Java中的函数,则您会用到WebView的addJavascriptInterface()函数。因为安全问题,在Android4.2中(如果应用的android:targetSdkVersion数值为17+)JS只能访问带有 @JavascriptInterface注解的Java函数。
之前,任何Public的函数都可以在JS代码中访问,而Java对象继承关系会导致很多Public的函数都可以在JS中访问,其中一个重要的函数就是 getClass()。然后JS可以通过反射来访问其他一些内容。通过引入 @JavascriptInterface注解,则在JS中只能访问 @JavascriptInterface注解的函数。这样就可以增强安全性。
如果您的应用android:targetSdkVersion数值为17或者大于17记得添加 @JavascriptInterface 注解。

js中调用 java中的clickedAgreement方法
CourseInfo.clickedAgreement(paramData.i,paramData.j,1);

据华为开发者官网最新消息,编译工具方舟编译器已经对外发布。
方舟编译器是基于 GCC 开发的交叉编译器套件,它包括了C、C++、Fortran 的前端,也包括了这些语言的库(如 libstdc++、libgcc 等)。HCC 运行在 X86 linux 架构服务器上,生成的二进制运行在 Aarch64 架构服务器上。

安装前准备

  1) 环境要求

  方舟编译器支持如下 64 位操作系统。

  SUSE12sp4 及以上版本。

  ubuntu16.04 及以上版本。

  其他 glibc 版本在 2.22 及以上的 Linux 发行版。

  2) 获取软件包

  安装方舟编译器需要获取如表2-1 所示的开源软件包。

GCC 7.3.0 编译器源码包  https://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz

  Binutils 2.31.1 汇编器、链接器等二进制工具集源码包  https://ftp.gnu.org/gnu/binutils/binutils-2.31.1.tar.gz

  Glibc 2.29 GNU libc 库源码包 https://git.linaro.org/toolchain/glibc.git/snapshot/glibc-2.29.tar.gz

  Mpc 1.1.0 复数运算库  https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz

  GNU MPFR 4.0.2 多精度浮点计算库  https://www.mpfr.org/mpfr-current/mpfr-4.0.2.tar.gz

  isl 0.21 集和线性约束范围内整数点关系的操作库  http://isl.gforge.inria.fr/isl-0.21.tar.gz

安装 HCC 编译器

  1) 操作步骤

  您可以使用 HCC tar 包将 HCC 安装到当前用户权限下的任何位置,而不会影响其他编译器的使用。

  a) 介绍操作入口,例如用 XX 帐号登录 XX 环境。

  b) 登陆 HCC 下载地址下载压缩包

  hcc_arm64le.tar.gz

  c) 将 tar 包拷贝至您想要安装的目录。

  命令脚本如下所示。

  cp hcc_arm64le.tar.gz /path/to/your/dir

  d) 解压缩软件包。

  命令脚本如下所示。

  tar zxvf hcc_arm64le.tar.gz

  e) 设置环境变量。

  设置环境变量命令脚本如下所示。

  export PATH=/path/to/your/dir/hcc_arm64le/bin:$PATH

  HCC 编译器提供的编译工具在=/path/to/your/dir/hcc_arm64le/bin 目录下。

  2) 安装后检查

  HCC 编译器安装完成后,可以执行 aarch64-linux-gnu-gcc -v 命令查询 HCC 版本。

  软件下载

  源码下载:立即下载

  据华为官方方面介绍,方舟编译器是首家完全替代语言虚拟机的静态编译器,完全不需要解释器。兼顾 Java 开发效率和C语言运行效率的编译器。相比现有的编译机制:

  1. 方舟编译器是一种静态的编译方式,而现有的安卓系统,运行一个应用程序首先启动虚拟机,然后读入应用程序代码,逐条解释执行。会占用较多的处理资源,影响程序执行的效率。当然,也有包括 AOT 或 JIT 等提前或运行时的编译技术,把部分程序转换成机器码直接在 CPU 上执行。但是,仍旧无法做到 100% 做到摆脱虚拟机的执行,这也是当前安卓阵营不如 IOS 阵营的关键。

  2. 华为方舟编译器的静态编译方式可将语言里的动态特性直接翻译成机器码,手机安装应用程序后可全速运行程序,彻底消除虚拟机的弊病,带来效率上的极大提升。

  3. 方舟编译器是在开发环境部署的编译器,而现有编译过程,主要发生在手机上,带来额外的资源消耗。

  目前方舟编译器针对通用 ARM 芯片架构进行编译优化,未来将通过软硬件协同设计,将麒麟芯片的能力发挥到极致。同时方舟编译器支持 Java 标准用法,三方应用可直接进行编译,不需要修改代码。但如果希望获得更加好的性能或内存方面的提升,则可以通过调整代码结构,与方舟编译器配合优化来实现。

免责声明
本博客部分内容来自于互联网,不代表作者的观点和立场,如若侵犯到您的权益,请联系[email protected]。我们会在24小时内进行删除。