Closed Amoystyle closed 5 years ago
Make sure, that you also patched androidfw library, as aapt depends on it. After patching the files, try following commands:
. ~/android/build/envsetup.sh
— define environment commands for building;cd ~/android/frameworks/base/tools/aapt && mm
— build aapt using Ninja build system, instead of using the Makefile. If it doesn't help, try android-tools-builder script: it automatically will do all for you.
Hi @lem0nez , Thanks for your time and attention for my request. I will test it and tell you about results.
If it doesn't help, try android-tools-builder script: it automatically will do all for you.
Android: master
the same error, when I build aapt using Ninja build system
inimal-arm-android.a ld.lld: error: undefined symbol: set_sched_policy referenced by Threads.cpp:0 (system/core/libutils/Threads.cpp:0) Threads.o:(thread_data_t::trampoline(thread_data_t const*)) in archive out/soong/.intermediates/system/core/libutils/libutils/android_arm_armv7-a-neon_core_static/libutils.a clang-9: error: linker command failed with exit code 1 (use -v to see invocation) 17:11:20 ninja failed with: exit status 1
@Amoystyle, script should sync the latest branch, which have following format: android-X.X.X_rX. But it synced the master branch. What is the output of this command?
git ls-remote -h 'https://android.googlesource.com/platform/manifest' | \
sed -r 's#^.+/##g; /^android-[1-9]/!d' | \
sort -rV | awk 'NR==1'
Please tell me how can I use these tools in android studio project to create R.java and Dex files etc from source files exactly as on windows ..Sry I am kind of new to these native libraries
@Amoystyle, script should sync the latest branch, which have following format: android-X.X.X_rX. But it synced the master branch. What is the output of this command?
git ls-remote -h 'https://android.googlesource.com/platform/manifest' | \ sed -r 's#^.+/##g; /^android-[1-9]/!d' | \ sort -rV | awk 'NR==1'
arno@arno-virtual-machine:~/Develop/Android/frameworks/base/tools/aapt$ mm ============================================ PLATFORM_VERSION_CODENAME=R PLATFORM_VERSION=R TARGET_PRODUCT=aosp_arm TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a-neon TARGET_CPU_VARIANT=generic HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-4.18.0-25-generic-x86_64-Ubuntu-18.04.2-LTS HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=PI OUT_DIR=out ============================================ [100% 58/58] Install: out/host/windows-x86/nativetest64/libaapt_tests/libaapt_te #### build completed successfully (14 seconds) ####
do something about it
system/core/libutils/Threads.cpp
// we use this trampoline when we need to set the priority with // nice/setpriority, and name with prctl. static int trampoline(const thread_data_t* t) { thread_func_t f = t->entryFunction; void* u = t->userData; int prio = t->priority; char * name = t->threadName; delete t; setpriority(PRIO_PROCESS, 0, prio); //if (prio >= ANDROID_PRIORITY_BACKGROUND) { // set_sched_policy(0, SP_BACKGROUND); //} else { // set_sched_policy(0, SP_FOREGROUND); //}
if (name) {
//androidSetThreadName(name);
free(name);
}
return f(u);
}
```c++
int androidSetThreadPriority(pid_t tid, int pri)
{
int rc = 0;
int lasterr = 0;
//if (pri >= ANDROID_PRIORITY_BACKGROUND) {
// rc = set_sched_policy(tid, SP_BACKGROUND);
//} else if (getpriority(PRIO_PROCESS, tid) >= ANDROID_PRIORITY_BACKGROUND) {
// rc = set_sched_policy(tid, SP_FOREGROUND);
//}
//if (rc) {
// lasterr = errno;
//}
if (setpriority(PRIO_PROCESS, tid, pri) < 0) {
rc = INVALID_OPERATION;
} else {
errno = lasterr;
}
return rc;
}
arno@arno-virtual-machine:~$ cd ~/Develop/Android/
arno@arno-virtual-machine:~~/Develop/Android$ . build/envsetup.sh
arno@arno-virtual-machine:~~/Develop/Android$ cd ~/Develop/Android/frameworks/base/tools/aapt
arno@arno-virtual-machine:~/Develop/Android/frameworks/base/tools/aapt$ mm
============================================
PLATFORM_VERSION_CODENAME=R
PLATFORM_VERSION=R
TARGET_PRODUCT=aosp_arm
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.18.0-25-generic-x86_64-Ubuntu-18.04.2-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=PI
OUT_DIR=out
============================================
[100% 117/117] Install: out/host/windows-x86/nativetest64/libaapt_tests/libaapt_tests.exe
#### build completed successfully (02:07 (mm:ss)) ####
ld.lld: error: undefined symbol: set_sched_policy referenced by Threads.cpp:0 (system/core/libutils/Threads.cpp:0) Threads.o:(thread_data_t::trampoline(thread_data_t const*)) in archive out/soong/.intermediates/system/core/libutils/libutils/android_arm_armv7-a-neon_core_static/libutils.a clang-9: error: linker command failed with exit code 1 (use -v to see invocation) 17:11:20 ninja failed with: exit status 1
do something about it
/Android/frameworks/base/tools/aapt/Android.bp
// Defaults for the target Android devices.
cc_defaults {
name: "aapt_defaults_target",
static_libs: [
"libandroidfw_target",
"libpng",
"libutils",
"liblog",
"libcutils",
"libexpat",
"libziparchive",
"libbase",
"libz",
"libjsoncpp", // <-- add it
"libcgrouprc_format", // <-- add it
"libcgrouprc", // <-- add it
"libprocessgroup", // <-- add it
],
group_static_libs: true,
static_executable: true,
cflags: [
"-Wall",
"-Werror",
],
target: {
android: {
enabled: true,
},
},
// This tool is prebuilt if we're doing an app-only build.
product_variables: {
pdk: {
enabled: false,
},
unbundled_build: {
enabled: false,
},
},
}