Compiling android5.1 source code encountered an error undefined reference to 'register_android_system_OsConstants(_JNIEnv*)'

Encountered undefined reference to 'register_android_system_OsConstants(_JNIEnv*)' when compiling 5.1 

The log is as follows:

host SharedLib: libjavacore_32 (out/host/linux-x86/obj32/lib/libjavacore.so)

prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/SHARED_LIBRARIES/libjavacore_intermediates/luni/src/main/native/android_system_OsConstants.o: file is empty
libcore/luni/src/main/native/Register.cpp:36: error: undefined reference to 'register_android_system_OsConstants(_JNIEnv*)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [out/host/linux-x86/obj32/lib/libjavacore.so] Error 1


It is because Ubuntu got stuck for some reason when compiling android_system_OsConstants.P, and most of them were compiled because the user forcibly ended the compilation and restarted the compilation, but the android_system_OsConstants.d was incomplete, so delete android_system_OsConstants.d directly to get cleared Compiled, just compile again. It should be noted here that some tools may not be installed completely before compiling. Official website requirements: https://source.android.com/source/initializing.html Refer to the official website configuration.

Guess you like

Origin blog.csdn.net/besidemyself/article/details/51006549