Commit: 47310cb
Branch: main
Message: "feat: implement build-time native library validation (Task 12)"
The push to main branch will automatically trigger the Codemagic CI/CD pipeline.
1. Environment Setup
↓
2. Download OpenCV Libraries
└─ scripts/download-opencv-libs-only.sh
↓
3. Build Process Starts
└─ ./gradlew assembleDebug
↓
4. ✨ NEW: validateNativeLibraries Task Runs Automatically
├─ Checks for libc++_shared.so
├─ Checks for libopencv_java4.so
├─ Validates all architectures
└─ Reports results
↓
5. If Validation Passes → Continue Build
If Validation Fails → Build Fails with Error Message
↓
6. APK Packaging
↓
7. Tests Run (including NativeLibraryValidationTest)
↓
8. Build Complete
==========================================
Native Library Validation
==========================================
Validation Results:
-------------------
armeabi-v7a:
✅ libc++_shared.so: Found in /opencv/src/main/jniLibs
✅ libopencv_java4.so: Found in /opencv/src/main/jniLibs
arm64-v8a:
✅ libc++_shared.so: Found in /opencv/src/main/jniLibs
✅ libopencv_java4.so: Found in /opencv/src/main/jniLibs
x86:
✅ libc++_shared.so: Found in /opencv/src/main/jniLibs
✅ libopencv_java4.so: Found in /opencv/src/main/jniLibs
x86_64:
✅ libc++_shared.so: Found in /opencv/src/main/jniLibs
✅ libopencv_java4.so: Found in /opencv/src/main/jniLibs
✅ All required native libraries are present!
==========================================
==========================================
Native Library Validation
==========================================
❌ Validation Failed!
Errors:
- Missing library: libc++_shared.so for architecture: arm64-v8a
- Missing library: libopencv_java4.so for architecture: arm64-v8a
==========================================
SOLUTION: Run the library acquisition script
==========================================
The required OpenCV native libraries are missing.
Please run one of the following scripts to download them:
Linux/Mac: ./scripts/download-opencv-libs-only.sh
Windows: .\scripts\download-opencv-libs-only.ps1
Or: ./scripts/setup-opencv.sh
==========================================
BUILD FAILED
The CI/CD pipeline will also run the new unit tests:
./gradlew test --tests "*NativeLibraryValidationTest"Test Cases That Will Run:
- ✅ testRequiredLibrariesList
- ✅ testSupportedArchitecturesList
- ✅ testValidateLibraryPresence_AllPresent
- ✅ testValidateLibraryPresence_MissingArchitecture
- ✅ testValidateLibraryPresence_MissingSpecificLibrary
- ✅ testValidateLibraryPresence_EmptyLibraryFile
- ✅ testValidateLibraryPresence_NoLibrariesAtAll
- ✅ testValidateLibraryPresence_DirectoryDoesNotExist
- ✅ testArchitectureSpecificValidation
- Go to your Codemagic dashboard
- Find the build for commit
47310cb - Watch the build logs in real-time
Look for:
=== SETTING UP OPENCV ANDROID SDK WITH CACHING ===
✅ OpenCV libraries found in cache - skipping download
or
✅ OpenCV setup script completed successfully
Look for:
> Task :app:validateNativeLibraries
==========================================
Native Library Validation
==========================================
Look for:
BUILD SUCCESSFUL in Xs
or
BUILD FAILED
-
Validation Task Runs
- Check logs for
> Task :app:validateNativeLibraries - Should run before
> Task :app:packageDebug
- Check logs for
-
All Libraries Validated
- Should see checkmarks for all 4 architectures
- Should see both required libraries per architecture
-
Build Completes Successfully
- APK should be generated
- Tests should pass
-
Unit Tests Pass
- All 9 NativeLibraryValidationTest cases should pass
# Search for validation task
grep "validateNativeLibraries" build.log
# Search for validation results
grep "Native Library Validation" build.log
# Search for test results
grep "NativeLibraryValidationTest" build.log
# Check for any failures
grep "FAILED" build.log- Total Build Time: ~5-10 minutes
- Validation Time: < 1 second
- Impact: Negligible (< 1% of total build time)
- Validation passes
- Build succeeds
- Tests pass
- APK generated
Action: None - validation system working perfectly!
- Validation detects missing libraries
- Build fails with clear error message
- Solution instructions provided
Action: Check if OpenCV download script ran successfully
- Validation passes
- Build succeeds
- Some unit tests fail
Action: Review test logs to identify specific failures
Check:
- Did OpenCV download script run?
- Are libraries in cache?
- Check validation error messages
Fix:
# In CI/CD, the download script should run automatically
# If it didn't, check codemagic.yaml configurationCheck:
- Which specific test failed?
- What was the error message?
- Is it a test environment issue?
Fix:
- Review test logs
- May need to adjust test for CI/CD environment
- Review validation output in logs
- Confirm all architectures validated
- Download and test APK
- Mark task as verified
- Review error messages
- Check which libraries are missing
- Verify OpenCV download script
- Re-run build if needed
While build is running, you can check status:
# Check latest commit
git log -1 --oneline
# Check remote status
git fetch origin
git status
# View recent commits
git log --oneline -5- NATIVE_LIBRARY_VALIDATION.md - Full validation guide
- BUILD_TIME_VALIDATION_SUMMARY.md - Implementation details
- VALIDATION_QUICK_REFERENCE.md - Quick commands
- CICD_BUILD_AUTOMATION_SUMMARY.md - CI/CD overview
Look for these in the build logs:
✅ > Task :app:validateNativeLibraries
✅ ✅ All required native libraries are present!
✅ BUILD SUCCESSFUL
✅ NativeLibraryValidationTest > testValidateLibraryPresence_AllPresent PASSED
Build Status: Check Codemagic dashboard Commit: 47310cb Branch: main Expected Result: ✅ Build Success with Validation