0

I'm trying to use Cronet on Android directly from my JNI / C++ layer, not through the Java API.

I already have the cronet.so (from Play Services / build output).

What I'm missing are the headers (like cronet_c.h / cronet.idl_c.h) so that I can call the Cronet C API functions (Cronet_Engine_Create, Cronet_UrlRequest_Create, etc.) directly from native code.

I tried building Chromium multiple times to extract the headers, but each attempt failed due to build complexity and system issues.

My question

👉 Is there a place to download or obtain the prebuilt Cronet headers for Android?

I don't want to go through the Java APIs and wrap them in JNI — I want to link against cronet.so directly from C++.

If not, then just help me with my building process wehre im failing, and what could be the solutions.

What I tried:

I attempted to build Chromium several times in order to extract the headers, but the build process failed multiple times due to complexity and system issues.

I couldn't find any official prebuilt SDK or standalone header package for Android.

I also tried a minimal build script:

#!/bin/bash
set -e

WORKDIR="$HOME/cronet_build"
DEPOT_TOOLS="$WORKDIR/depot_tools"
SRC_DIR="$WORKDIR/src"
OUT_DIR="$SRC_DIR/out/Release"

sudo apt-get update
sudo apt-get install -y git python3 curl unzip gnupg build-essential clang lld ninja-build pkg-config libnss3 libnss3-dev openjdk-17-jdk

if [ ! -d "$DEPOT_TOOLS" ]; then
    git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "$DEPOT_TOOLS"
fi
export PATH="$DEPOT_TOOLS:$PATH"

mkdir -p "$WORKDIR"
cd "$WORKDIR"
fetch --nohooks chromium

cd "$SRC_DIR"
gclient sync --with-branch-heads

gn gen "$OUT_DIR" --args='
is_debug=false
target_os="android"
target_cpu="arm64"
is_cronet_package=true
'

autoninja -C "$OUT_DIR" cronet_package

That failed with an error about siso not found.

Then I tried again with updated args:

gn gen "$HOME/release" --args='
is_debug=false
target_os="android"
target_cpu="arm64"
is_component_build=false
use_siso=false
'

This succeeded in generating targets:

Done. Made 57416 targets from 4018 files in 15328ms

But when I tried to build:

cd ~/cronet_build/src
autoninja -C ~/release cronet

I got:

ninja: error: unknown target 'cronet', did you mean 'root'?

And with:

autoninja -C ~/release cronet_package

I got:

ninja: error: unknown target 'cronet_package'

What I expected:

A way to obtain the Cronet headers separately (without building Chromium fully).

Ideally, an official or reliable source for downloading the headers so I can include them in my NDK/JNI project and link against cronet.so.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.