• C++ 继承

     · 7 min read  · Grape
    export NDK_ROOT=~/android-ndk-r18b
    
    ${NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
      --target=x86_64-none-linux-android
      --gcc-toolchain=${NDK_ROOT}/toolchains/x86_64-4.9/prebuilt/linux-x86_64
      --sysroot=${NDK_ROOT}/sysroot
      -isystem ${NDK_ROOT}/sysroot/usr/include/x86_64-linux-android
      -pie -o  hello.c.o -c hello.c
    
    ${NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
      --target=x86_64-none-linux-android
      --gcc-toolchain=${NDK_ROOT}/toolchains/x86_64-4.9 …
  • Android Unicode 字符串

     · Grape

    相关源码

    String16

    // http://androidxref.com/6.0.1_r10/xref/system/core/libutils/String16.cpp#allocFromUTF8
    static char16_t* allocFromUTF8(const char* u8str, size_t u8len)
    {
        const ssize_t u16len = utf8_to_utf16_length(u8cur, u8len);
        utf8_to_utf16(u8cur …
  • Android 智能指针

     · Grape

    相关源码

    http://androidxref.com/6.0.1_r10/xref/system/core/include/utils/StrongPointer.h http://androidxref.com/6.0.1_r10/xref/system/core/include/utils/RefBase.h http://androidxref.com/6.0.1_r10/xref/system/core/libutils/RefBase.cpp

    StrongPointer

    INITIAL_STRONG_VALUE 为什么不是0 …

  • Android 源码开发

     · 1 min read  · Grape

    准备开发环境

    使用docker-aosp搭建

    编译步骤

    source build/envsetup.sh 
    including device/asus/deb/vendorsetup.sh
    including device/asus/flo/vendorsetup.sh
    including device/asus/fugu/vendorsetup.sh
    including device/generic/mini-emulator-arm64/vendorsetup.sh
    including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
    including device/generic …
  • Docker 基础

     · 2 min read  · Grape

    Dockerizing a Python Flask App

    Install nginx 1.27.2

    docker pull nginx:1.27.2
    docker pull python:3.13
    
    services:
      web:
        container_name: example_nginx
        image: nginx:1.27.2
        privileged: true
        ports:
          - 80:80
          - 443:443
        volumes:
          - "$PWD/html:/usr/share/nginx/html:rw"
          - "$PWD/conf/conf.d:/etc …
  • Android ClassLoader

     · 1 min read  · Grape

    Class

    // http://androidxref.com/6.0.1_r10/xref/libcore/libart/src/main/java/java/lang/Class.java
    public final class Class<T> implements Serializable, AnnotatedElement, GenericDeclaration, Type {
        static native Class<?> classForName(String className, boolean shouldInitialize,
            ClassLoader classLoader) throws ClassNotFoundException;
    }
    

    VMClassLoader

    // http://androidxref.com/6.0.1_r10/xref/libcore/libart/src …
  • Android ProgressBar Circle

     · 1 min read  · Grape

    Shape

    <?xml version="1.0" encoding="utf-8"?>
    <shape
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape=["rectangle" | "oval" | "line" | "ring"] 
        android:innerRadius="integer"
        android:innerRadiusRatio="integer"
        android:thickness="integer"
        android:thicknessRatio="integer"
        android:useLevel="boolean"
        >
        <corners
            android:radius="integer"
            android:topLeftRadius="integer"
            android:topRightRadius="integer"
            android:bottomLeftRadius …
  • Java 知识点

     · Grape

    可变参数

    变长参数是 Java 的一个语法糖,本质上还是基于数组的实现:

    void Foo(String... args);
    void Foo(String[] args);
    
    // Method signature
    ([Ljava/lang/String;)V // public void foo(String[] args)
    

    注意事 …

  • Github Usage

     · 1 min read  · Grape

    如何修改第一条的作者信息

    git commit --amend --author="developer <[email protected]>" --no-edit
    

    如何修改第一条注释信息

    git commit --amend
    

    子模块

    递归更新子模块:

    git submodule add <remote url …
  • 7z 解压文件名乱码

     · Grape

    问题描述

    在Windows 7中文版系统上使用7z压缩一些文件后,然后在Windows 10 Pro英文版系统上解压,发现凡是文件名中包含中文,最后都是乱码。

    原因

    使用7z压缩文件时,对文件名的编码是采用Windows 系统默 …

  1. 1
  2. 2
  3. 3
  4. 4