Android tips - yszheda/wiki GitHub Wiki
References
Hardware specs
CPU
adb shell getprop ro.product.cpu.abi
- https://stackoverflow.com/questions/10920747/android-cpu-arm-architectures
- How do I know if an Android device is running on ARMv7 or ARMv6?
- How to See What Kind of Processor You Have (ARM, ARM64, or x86)
number of cpu cores
cat /sys/devices/system/cpu/present
cat /sys/devices/system/cpu/possible
Memory
adb shell am dumpheap your.package.name /sdcard/heap-original.hprof
adb pull /sdcard/heap-original.hprof .
$ANDROID_SDK/platform-tools/hprof-conv heap-original.hprof heap-converted.hprof
- How to find memory usage of my android application written C++ using NDK
- https://developer.android.com/reference/android/os/Debug.html#getNativeHeapAllocatedSize%28%29
static long getNativeHeapAllocatedSize(JNIEnv *env)
{
jclass clazz = env->FindClass("android/os/Debug");
if (clazz)
{
jmethodID mid = env->GetStaticMethodID(clazz, "getNativeHeapAllocatedSize", "()J");
if (mid)
{
return env->CallStaticLongMethod(clazz, mid);
}
}
return -1L;
}
static long getNativeHeapSize(JNIEnv *env)
{
jclass clazz = env->FindClass("android/os/Debug");
if (clazz)
{
jmethodID mid = env->GetStaticMethodID(clazz, "getNativeHeapSize", "()J");
if (mid)
{
return env->CallStaticLongMethod(clazz, mid);
}
}
return -1L;
}
DDMS
- How to enable native heap tracking in DDMS
- https://groups.google.com/forum/#!topic/android-porting/nIS6oQzru2g
- Android NDK: Dalvik Heap and Native Heap - How Separate Between the two
- DDMS调试native heap实战
- 使用android ddms native heap查看Native层内存 by 空子
- How to Find memory leaks from native code in android
- android调试工具DDMS
- How to automate the DDMS snapshot mechanism?
dumpNativeHeap
- https://android.googlesource.com/platform/frameworks/base/+/kitkat-release/core/jni/android_os_Debug.cpp
- How to call dumpNativeHeap api?
- Android : How to analyse the native heap dump?
GPU
adb shell dumpsys
GPU monitor
- https://stackoverflow.com/questions/10512706/how-do-i-check-gpu-usage-of-android-device
- https://stackoverflow.com/questions/32882946/gpu-monitoring-doesnt-work-in-android-studio-1-4
Busybox
warnings as errors
static cannot use -fsanitize=address
- Google wiki: AddressSanitizer
- Clang 5 documentation: AddressSanitizer
- gcc: 3.11 Program Instrumentation Options
- 利用Address Sanitizer工具检查内存访问错误
- Address-Sanitizer(ASAN): 一個 C/C++ 記憶體偵錯的工具
-llsan not found
modutils-24.c query_module undefined
- https://dev.openwrt.org/ticket/7460
- https://dev.openwrt.org/ticket/8933#no2
- 编译busybox-1.3.2的时候遇到的错误解决办法
Static linking against glibc, can't use --gc-sections
SDK
ConstraintLayout
- https://stackoverflow.com/questions/39252102/how-to-install-android-constraint-layout-tools-outside-of-android-studio-by-usin
- https://stackoverflow.com/questions/38930654/unable-to-find-and-use-android-constraintlayout-as-before
- Android Studio 2.2 NDK/JNI配置
Cross compile
Enable NEON
- How can i enable VFP or NEON support in my C++ Android appolication?
- How do I enable ARM NEON builds using Gradle?
error: only position independent executables (PIE) are supported.
Lib
OpenCV
OpenBLAS
- Openblas编译Android NDK库的步骤
- [笔记]如何在android中使用mxnet的10M以内的小型CNN做图像识别
- https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android
- Building for Android doesn't generate shared lib (.so)
- https://stackoverflow.com/questions/37099605/undefined-reference-to-cblas-sgemm
Relocations in generic ELF (EM: 40)
- https://stackoverflow.com/questions/23185341/relocations-in-generic-elf-em-40
- https://stackoverflow.com/questions/8168950/cross-compiling-c-project-relocations-in-generic-elf-em-3
- https://stackoverflow.com/questions/41859579/how-to-resolve-relocations-in-generic-elf-during-ndk-build
Android.mk
- Android.mk relative or absolute paths?
- http://android.mk/
- Read environment variable in make file
- How to print a var using echo o print in a NDK-build Android.mk file to debug compilation?
AndroidManifest.xml
The file name must end with .xml or .png
- https://stackoverflow.com/questions/6726722/ppm-images-in-android
- Android: Using SVG in res leads to error: “The file name must end with .xml or .png”
Launch or kill APP
adb shell am start -n com.package.name/com.package.name.ActivityName
adb shell am kill com.package.name/com.package.name.ActivityName