We have also introduced a lot about webrtc compilation before. Because GN is much faster than gyp, we use GN to generate construction scripts and Ninja to build webrtc.
GN generate Ninja command
Common commands for generating Ninja build files using GN are as follows:
// Generate a debug version of the build file, default configuration
gn gen out/Debug
// Generate a build file for the release version
gn gen out/Release --args="is_debug=false"
Ninja script
The gyp scripts under skia \ gyp are templates. When sync and gyp is executed, the actual build scripts will be generated dynamically according to these templates. Many module dependencies and conditions can be found in gyp or gypi under this directory.
Use the Ninja – C out/release instruction to compile and report an error
When compiling the webrtc SDK required by Android using the Ninja – C out/release instruction, the following error occurred:
Ninja: entering directory ` Android/release ‘
Ninja: error:’… /…/third ‘_party/android_ ndk/sources/android/cpufeatures/cpu-features.c’, needed by ‘obj/third_ party/android_sdk/cpu_features/cpu-features.o’, missing and no known rule to make it
From this error report, we can know that there is a problem with the file dependency and the required file cannot be found. Sometimes, the project directory changes and dependencies cannot be found. For webrtc, the plug-ins that depend on will be downloaded to the third-party library in webrtc, but the cpu-features.c file cannot be found when opening the third-party library in webrtc, which indicates that webrtc lacks an Android NDK third-party.
Therefore, we need to download the required NDK from the official Android website(https://developer.android.google.cn/ndk/downloads/revision_History) and copy it to third under the webrtc directory_part/android_Inside the NDK. Then run the Ninja – C out/release command again, and the error disappears.
Read More:
- [error record] Android application release package error handling (turn off syntax check log processing release configuration)
- [Solved] Android Kotlin Package release Error: Lint found fatal errors while assembling a release target.
- [Solved] Android Studio Error:SDK location not found.
- [Solved] Android Studio 4 Error: The application could not be installed: INSTALL_FAILED_OLDER_SDK
- [Solved] Appium Install Error: Original error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variab
- [Solved] Failed to install the following Android SDK packages as some licences have not been accepted
- [Solved] ninja: error: build.ninja:1802: multiple rules generate Debug/xxx.exe [-w dupbuild=err]
- [Solved] Compile Error: AAPT: error: resource android:attr/lStar not found
- error: resource android:attr/lStar not found [Pefect Solution]
- error: resource android:attr/lStar not found [How to Solve]
- Remember an android app startup error Error running: Default Activity not found
- [Solved] Android Studio Start Error: Missing essential plugin: org.jetbrains.android Please reinstall Android
- error: resource android:attr/lStar not found [How to Solve]
- [Solved] Flutter – AAPT: error: resource android:attr/dialogCornerRadius not found.
- Android studio reports an error when running the main() method
- JZVideo Error: Attempt to invoke virtual method ‘android.view.Window android.app.Activity.getWindow()’ on a null object reference
- [Solved] AAPT: error: resource android:attr/lStar not found
- Android Error: Android resource linking failed [How to Solve]
- [Solved] Gradle NullPointerException at com.android.build.gradle.internal.ndk.NdkHandler.getPlatformVersion