I am new to Android development, now building Firefox for Android following document at https://firefox-source-docs.mozilla.org/mobile/android/fenix.html. When I install generated fenix-fenix-arm64-v8a-debug.apk and launch app, it shows spash window with Firefox icon and exits immediately. I have tried to build on Ubuntu and Windows, and tested on several android devices, all the same. Here are my build steps on Windows:
install https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe
run C:\mozilla-build\start-shell.bat
cd C:/
mkdir mozilla-source
cd mozilla-source
wget https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py
python3 bootstrap.py --vcs=git (choose "3. GeckoView/Firefox for Android Artifact Mode")
add "ac_add_options --target=aarch64" to mozconfig
./mach build
./mach gradle clean fenix:assembleDebug
and adb logcat: https://1drv.ms/u/c/01cff2ee4af3350f/ERFNM5jsp5JNjCY1DcVxujYBXCtIjignAGe2IsYrUNGYDQ?e=qWdgg6. Am i missing anything?
Try to disable the strict mode in the FenixApplication class.
Look for something similar to components.strictMode.enableStrictMode(true)
and change it to false.
02-18 14:22:21.511 24007 24296 E AndroidRuntime: Process: org.mozilla.fenix.debug, PID: 24007
02-18 14:22:21.511 24007 24296 E AndroidRuntime: java.lang.RuntimeException: StrictMode ThreadPolicy violation
02-18 14:22:21.511 24007 24296 E AndroidRuntime: at org.mozilla.fenix.perf.ThreadPenaltyDeathWithIgnoresListener.penaltyDeath(ThreadPenaltyDeathWithIgnoresListener.kt:46)
02-18 14:22:21.511 24007 24296 E AndroidRuntime: at org.mozilla.fenix.perf.ThreadPenaltyDeathWithIgnoresListener.onThreadViolation(ThreadPenaltyDeathWithIgnoresListener.kt:40)
02-18 14:22:21.511 24007 24296 E AndroidRuntime: at android.os.StrictMode$AndroidBlockGuardPolicy.lambda$onThreadPolicyViolation$1(StrictMode.java:1995)
02-18 14:22:21.511 24007 24296 E AndroidRuntime: at android.os.StrictMode$AndroidBlockGuardPolicy$$ExternalSyntheticLambda0.run(Unknown Source:4)
02-18 14:22:21.511 24007 24296 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
02-18 14:22:21.511 24007 24296 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
02-18 14:22:21.511 24007 24296 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012)