平台
Android builds
Build an Expo app as a release APK that trusts danwo's proxy, and reuse it until its sources change.
An Android app trusts only the system's certificates unless its build says otherwise. danwo's
proxy has its own certificate, created for each run. danwo build-android builds your Expo app so
it trusts it.
Build it
npx @danwo/cli build-android appapp is the folder of your Expo project. The same command builds a Gradle project
(Native Android apps) or a Flutter app (Flutter); it
tells them apart by what the folder holds. For an Expo app, danwo:
- runs
expo prebuild; - adds a network security config that also trusts user-installed certificates, where danwo puts each run's;
- runs
gradlew assembleReleasewithDANWO=1, using Android Studio's JDK whenJAVA_HOMEis unset.
The JavaScript is bundled into the APK, so no Metro server runs during tests. Gradle runs with
--no-daemon and compiles Kotlin in its own process, so the build leaves no Gradle or Kotlin
daemon running.
Reuse it
The APK is kept under <project>/.danwo/builds/, keyed by a hash of the app's sources. An
unchanged app isn't built again. Force a rebuild with --force.
Workers share one build. On a cold run the first worker builds the app, and the others wait for it and then install the same APK.
Build it from the config
buildAndroid from @danwo/mobile does the same inside your environment, so a test run always has
a current build:
import { buildAndroid } from "@danwo/mobile"
export async function currentApk(): Promise<string> {
const build = await buildAndroid({ project: "app" })
return build.apk
}This build trusts user-installed certificates. Use it only for testing; ship your store builds without it.