Preparing for the Compilation Environment

1. Download Android Studio

2. Download the android – the NDK – r14b – Linux – x86_64. Zip

Once you have downloaded Android Studio, create a new folder Android Studio in your home directory and run the following command:

Sudo tar XVF android - studio - ide - 201.7199119 - Linux. Tar. Gz

When decompressed, an Android-studio directory will appear. Run the./studio. Sh command in the bin directory to open Android stuido

Then create a new project randomly. After the project can be opened successfully, you can see the location of our SDK in Local. properites, and record it first.

/home/liang/Android/Sdk = /home/liang/Android/Sdk = /home/liang/Android/Sdk Put the downloaded NDK-r14b into the NDK directory and run the decompression command:

sudo unzip android-ndk-r14b-linux-x86_64.zip

Download ijkPlayer source code

Download the Git tool and run the following command:

sudo apt-get update 
sudo apt-get install git
Copy the code

compile

Check out this blog post here

The last demo in the above blog requires modifying the root gradle file:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
  }
  
allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}
Copy the code

Blog mentioned ijkplayer/android/contrib/tools/do – the compile – ffmpeg. Sh file modified reference:

Compile-ijk.sh changes.

Errors encountered

ERROR 1: Each compilation execution ends with: ERROR: Failed to create toolchain

You can refer to this article by command

Python2 -v to see if PYTHon2 is installed

Solutions:

1. You can change Python to PYTHon3 as described in the previous article

2. Or download python2

sudo apt-get install python

I did it the second way.

BFD: libncurses.so.5: Cannot open shared object file: No such file or directory

sudo apt install apt-file
sudo apt-file update
sudo apt-file find libncurses.so.5
sudo apt install libncurses5
Copy the code

Mistake 3: meet. / libavutil/timer. H: : bind the fatal error: Linux/perf_event. H: No to the file or directory

Ln -s module-default.sh modul. sh is usually executed after the compilation, so we modify the modul. sh file in config directory. Add the following lines at the beginning of the file:

export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-linux-perf"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bzlib"
Copy the code