Error in building android image, fails with jack server - android

I am trying to build an android image, the build system by default uses jack server which keeps on failing again and again.
Can any body tell me how can i fix it.
I get the following error during build
FAILED: setup-jack-server /bin/bash -c
"(prebuilts/sdk/tools/jack-admin install-server
prebuilts/sdk/tools/jack-launcher.jar
prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 2>&1 || (exit 0) ) &&
(JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8
-XX:+TieredCompilation" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server
prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit
0 ) && (prebuilts/sdk/tools/jack-admin update jack
prebuilts/sdk/tools/jacks/jack-4.32.CANDIDATE.jar 4.32.CANDIDATE ||
exit 47 )" Writing client settings in /home/test/.jack-settings
Installing jack server in "/home/test/.jack-server"
Warning: The JKS keystore uses a proprietary format. It is recommended
to migrate to PKCS12 which is an industry standard format using
"keytool -importkeystore -srckeystore
/home/test/.jack-server/server.jks -destkeystore
/home/test/.jack-server/server.jks -deststoretype pkcs12".
Warning: The JKS keystore uses a proprietary format. It is recommended
to migrate to PKCS12 which is an industry standard format using
"keytool -importkeystore -srckeystore
/home/test/.jack-server/client.jks -destkeystore
/home/test/.jack-server/client.jks -deststoretype pkcs12".
Communication error with Jack server (58), try 'jack-diagnose' or see
Jack server log Failed to contact Jack server: Problem reading
/home/test/.jack-server/client.pem. Try 'jack-diagnose' Failed to
contact Jack server: Problem reading
/home/test/.jack-server/client.pem. Try 'jack-diagnose'
Jack server diagnose also dosen't give any usefull information
./prebuilts/sdk/tools/jack-diagnose error: process ID list syntax
error
Usage: ps [options]
Try 'ps --help <simple|list|output|threads|misc|all>' or 'ps --help
<s|l|o|t|m|a>' for additional help text.
For more details see ps(1). Port 8077 is used by another process
(pid=), please ensure to free the port or change port configuration in
'/home/test/.jack-settings' and
'/home/test/.jack-server/config.properties' error: process ID list
syntax error
Usage: ps [options]
Try 'ps --help <simple|list|output|threads|misc|all>' or 'ps --help
<s|l|o|t|m|a>' for additional help text.
For more details see ps(1). Port 8076 is used by another process
(pid=), please ensure to free the port or change port configuration in
'/home/test/.jack-settings' and
'/home/test/.jack-server/config.properties'
and jack program throws an error for open SSL connect.
SSL error when connecting to the Jack server, retrying with debug
Trying 127.0.0.1...
TCP_NODELAY set
Connected to localhost (127.0.0.1) port 8076 (#0)
ALPN, offering h2
ALPN, offering http/1.1
successfully set certificate verify locations:
CAfile: /home/test/.jack-server/server.pem CApath: /etc/ssl/certs } [5 bytes data]
TLSv1.3 (OUT), TLS handshake, Client hello (1): } [512 bytes data]
OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:8076
Closing connection 0
Can anybody please help me out in resolving this. I am struggling to get a clean build.

When Jack diagnose gives error 35 (SSL error) the following steps worked for me
Edit java.security file under /etc/java-8-openjdk/security/
Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms
Restart the jack server:
cd <aosp-home-dir>/prebuilts/sdk/tools/
./jack-admin kill-server
./jack-admin start-server

Related

FAILED: setup-jack-server when building LineageOS

I'm attempting to build LineageOS for the Moto Z (griffin) on a server, but the build crashes and burns 5 minutes out the gate.
FAILED: setup-jack-server
/bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx16G\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.32.CANDIDATE.jar 4.32.CANDIDATE || exit 47 )"
Jack server already installed in "/home/dablord/.jack-server"
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx16G -cp /home/dablord/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log
No Jack server running. Try 'jack-admin start-server'
No Jack server running. Try 'jack-admin start-server'
[ 3% 911/25667] //art/compiler:libart-compiler clang++ optimizing/instruction_builder.cc [linux x86]
ninja: build stopped: subcommand failed.
07:02:53 ninja failed with: exit status 1
The server is set up for personal use. It has 24GB RAM and 300GB of available storage. I also set up a 20GB swap file in case the Jack server somehow needed more.
The Jack log file reports the follwing:
07:29:02.699: INFO: com.android.jack.server.JackHttpServer: Loading config of jack server version: 1.3-a11 '1.3' (402300 704631c4e9bbfb4e8b052365140f79974b9f4cf4 by android-jack-team#google.com)
07:29:02.747: INFO: com.android.jack.server.JackHttpServer: Starting service connection server on /127.0.0.1:8076
07:29:02.754: SEVERE: com.android.jack.launcher.ServerLauncher: Server 1 Exception
com.android.jack.server.api.v01.ServerException: Problem while opening service port
at com.android.jack.server.JackHttpServer.start(JackHttpServer.java:785)
at com.android.jack.server.JackServerImpl.run(JackServerImpl.java:67)
at com.android.jack.launcher.ServerLauncher$3.run(ServerLauncher.java:392)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at com.android.jack.server.ServerParameters.openSocket(ServerParameters.java:88)
at com.android.jack.server.ServerParameters.getServiceSocket(ServerParameters.java:67)
at com.android.jack.server.JackHttpServer.start(JackHttpServer.java:779)
... 3 more
I've attempted to change the port # in the jack config files, reinstalling jack, resyncing the repo, all to no avail.
I also ran into this problem and it appeared to be BOTH an issue with TLS, guessing the older build was trying to use an obsoleted TLS version, AND a memory issue.
TLS
I followed Error in building android image, fails with jack server:
Edit java.security file under /etc/java-8-openjdk/security/
Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms
Restart the jack server:
jack-admin kill-server
jack-admin start-server
Memory
NOTE: It's necessary for the build to first fail before running the following steps.
I followed the recommendation here: https://groups.google.com/g/android-building/c/8SQ0-4zZDo8, specifically, I needed to run
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx7000m"
AND
I modified ~/.jack-server/config.properties:
jack.server.max-service=1
Success
After that I was able to build LineageOS
Quick and dirty fix which bypasses the problem is disabling jack entirely following Yan's answer here. I'm leaving the question open however, since it doesn't actually solve the problem.
1.I made it past this error by adding and editing the following variables before building.
export LC_ALL
2.Edit java.security file under /etc/java-8-openjdk/security/
Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms
Restart the jack server:
jack-admin kill-server
jack-admin start-server
3.. build/envsetup.sh
4.Run brunch command
brunch lineage_jfltexx-userdebug

I have accidentally uninstalled jack server while building Android AOSP

I am building the Android code for Android Go on my ubuntu 14.04 machine.
While building I got some problems with jack server and I ended up uninstalling the jack server (accidentally).
How do I install the Jack Server again ?
I have tried to install the jack server using the following command:
jack-admin install-server jack-launcher.jar jack-server-4.11.ALPHA.jar
However, I get an error:
Jack server installation not found
Kindly help how do I install Jack Server again.
I have also followed guides from Google Search Result but it has not helped so far.
Update -1
After trying the answer from #gaoc I get the following error each time I try to make the build. :
[ 0% 19/82490] Ensuring Jack server is installed and started
FAILED: setup-jack-server
/bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.32.CANDIDATE.jar 4.32.CANDIDATE || exit 47 )"
Jack server already installed in "/home/c_sganig/.jack-server"
Communication error with Jack server (3), try 'jack-diagnose' or see Jack server log
Communication error with Jack server 3. Try 'jack-diagnose'
Communication error with Jack server 3. Try 'jack-diagnose'
[ 0% 34/82490] build out/target/product/msm8909go/emmc_appsboot.mbn
make: Entering directory `/home/c_sganig/code/LA.UM.6.7.r1/bootable/bootloader/lk'
including app/aboot dev/fbcon dev/gcdb/display dev/keys dev/pmic/pm8x41 dev/pmic/pmi8994 dev/qpnp_haptic dev/vib lib/debug lib/heap lib/libc lib/libfdt lib/openssl lib/ptable
including lib/openssl/crypto lib/zlib_inflate
make[1]: Entering directory `/home/c_sganig/code/LA.UM.6.7.r1/bootable/bootloader/lk'
generating ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/config.h
generating ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/system-onesegment.ld
linking ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk
../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-ld: warning: /home/c_sganig/code/LA.UM.6.7.r1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/../lib/gcc/arm-eabi/4.8/libgcc.a(bpabi.o) uses 32-bit enums yet the output is to use variable-size enums; use of enum values across objects may fail
../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-ld: warning: /home/c_sganig/code/LA.UM.6.7.r1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/../lib/gcc/arm-eabi/4.8/libgcc.a(_divdi3.o) uses 32-bit enums yet the output is to use variable-size enums; use of enum values across objects may fail
../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-ld: warning: /home/c_sganig/code/LA.UM.6.7.r1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/../lib/gcc/arm-eabi/4.8/libgcc.a(_udivdi3.o) uses 32-bit enums yet the output is to use variable-size enums; use of enum values across objects may fail
generating image: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.bin
generating listing: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.lst
generating symbols: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.sym
generating listing: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.debug.lst
text data bss dec hex filename
367924 200272 202520 770716 bc29c ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk
../../../prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-objcopy -O binary ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.bin
generating size map: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk.size
generating stripped elf: ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk_s.elf
cp -f ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/build-msm8909/lk_s.elf ../../../out/target/product/msm8909go/obj/EMMC_BOOTLOADER_OBJ/../../emmc_appsboot.mbn
make[1]: Leaving directory `/home/c_sganig/code/LA.UM.6.7.r1/bootable/bootloader/lk'
make: Leaving directory `/home/c_sganig/code/LA.UM.6.7.r1/bootable/bootloader/lk'
ninja: build stopped: subcommand failed.
11:47:18 ninja failed with: exit status 1
#### failed to build some targets (45 seconds) ####
Show the list of removed packages:
$ awk '$3 == "remove" { print $1, $2, $4 }' /var/log/dpkg.log | tee list
If you can find the removed package in the list, then reinstall:
$ sudo apt-get install --reinstall nameofpackage
Following is the solution that helped me with jack server issue:
Delete ~/.jack-server directory and ~/.jack.settings file. This will be recreated when we run make command, so nothing to worry about that.
Sync repo again using this command (takes about 30-40 minutes):
repo sync -c --no-clone-bundle --no-tags -j4
This -c option with sync command will tell the git about branch you really need instead of all repositories. -jn (-j4 in my case) , here n refers to the number of threads you want.
Now build environment , lunch and make as usual.
I will also share another link to Google Group which has some significant information regarding this issue. : https://issuetracker.google.com/issues/37070263

wpa_supplicant reply to any command with UNKNOWN COMMAND except PING, LIST_NETWORKS, ATTACH, DETACH, TERMINATE, and STATUS?

First of all my target system is android.
I created a c++ application to communicate with wpa_supplicant through the control interface provided as a wpa_ctrl.c file (I included the header file wpa_ctrl.h and linked with the library libwpa_client.so)
here is the documentation page.
Every thing was working fine, but suddenly every command I send is replied by UNKNOWN COMMAND, I suppose that the commands that work fine (ping, list_networks, status, and terminate) have a common thing (maybe they do not need to open the wpa_supplicant.conf which causes the problem on other commands)
here is how I open the connection:
this->ctrl = wpa_ctrl_open(this->socket.c_str());
here is how I send commands:
s = wpa_ctrl_request(this->ctrl, cmd.c_str(), cmd.length(), this->_reply, &reply_len, msg_cb);
above method signatures:
struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path);
int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
char *reply, size_t *reply_len,
void (*msg_cb)(char *msg, size_t len));
example output:
PING
PONG
UNKNOWN COMMAND: MIB
UNKNOWN COMMAND: STATUS-VERBOSE
UNKNOWN COMMAND: PMKSA
UNKNOWN COMMAND: LOGON
UNKNOWN COMMAND: LOGOFF
UNKNOWN COMMAND: REASSOCIATE
UNKNOWN COMMAND: RECONNECT
UNKNOWN COMMAND: RECONFIGURE
LIST_NETWORKS
network id / ssid / bssid / flags
UNKNOWN COMMAND: DISCONNECT
UNKNOWN COMMAND: SCAN
UNKNOWN COMMAND: SCAN_RESULTS
UNKNOWN COMMAND: BSS
UNKNOWN COMMAND: ADD_NETWORK
STATUS
p2p_device_address=12:d3:8a:c8:34:ef
p2p_state=IDLE
wifi_display=1
ifname=p2p0
address=12:d3:8a:c8:34:ef
ifname=wlan0
address=10:d3:8a:c8:34:ef
UNKNOWN COMMAND: ADD_NETWORK
closed connection with wpa_supplicant.
Can not create Network
Here is a screenshot of an older version of the program working almost fine:
any help is appreciated.
EDIT: I tested the program on my other device and it worked well. But still broken on my main device, probably a factory reset will solve it. But I still want to know the cause of the problem.
The problem was that the interface name was wrong.

Function: selinux_android_load_priority [0], There is no sepolicy file

I have 2 errors in logcat.
Function: selinux_android_load_priority [0], There is no sepolicy file
04-11 10:58:13.837: E/SELinux(10101): Function: selinux_android_load_priority , loading version is VE=SEPF_SGH-I337M_4.3_0022
It's not fatal, my app seems to be fine.
Any idea what is the cause, and how do I fix it? Just can have Error Logs in my app!
I don't know how to get rid of those messages. But they do prevent the Android NDK ndk-gdb script from working. I found this question while searching for a way to get the debugger working after getting this error:
ERROR: Could not setup network redirection to gdbserver?
Maybe using --port=<port> to use a different TCP port might help?
This seems to be an issue with some phones - possibly Samsung phones, or at least the one that I am working with is a Samsung Galaxy Note 2. Certain commands (such as run-as) come with these selinux warning messages in stderr output.
The ndk-gdb script parses output from shell commands run on a device to determine facts like the path of the data directory for the package that it is debugging. The selinux messages interfere with that collection. To fix that problem, edit $NDK_HOME/ndk-gdb and make this change:
diff --git a/ndk-gdb b/ndk-gdb
index 537808e..c8561e5 100755
--- a/ndk-gdb
+++ b/ndk-gdb
## -620,7 +620,7 ## else
fi
# Find the <dataDir> of the package on the device
-adb_var_shell2 DATA_DIR run-as $PACKAGE_NAME /system/bin/sh -c pwd
+adb_var_shell DATA_DIR "run-as $PACKAGE_NAME /system/bin/sh -c pwd 2>/dev/null"
if [ $? != 0 -o -z "$DATA_DIR" ] ; then
echo "ERROR: Could not extract package's data directory. Are you sure that"
echo " your installed application is debuggable?"

android monkey runner scripts

I was trying to run a a sample python program using monkey runner but unfortunately throwing an error of this type :
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF)
Exception in thread "main" java.lang.NullPointerException
so any one can guide me how to resolve this and how to use monkey runner to execute this type of things
I've found that making the path to the script absolute helped monkeyrunner.
I am invoking the runner from a Python script where a helper class has a startMonkey method:
def startMonkey(self, monkeyScript):
command = [ self.env + '\\tools\\monkeyrunner.bat' ]
command.append( os.path.abspath( monkeyScript ) )
return startProcess( command )
This seems to be working for me.
Script file should be a full path file name try below monkeyrunner c:\test_script\first.py
So go to the folder \ sdk \ tools
and press shift and right click to open command prompt and type monkeyrunner c:\test_script\python_file_name.py

Categories

Resources