Android Studio Integrated Ijkplayer

Source: Internet
Author: User

Introduced

Ijkplayer is a very hot open-source video player, Android and iOS Universal. about how to compile your own project in how to import Android studio, where a lot of pits, this article records its own operation record. The current version of Ijkplayer is 0.8.3 and is, of course, integrated with the latest version.

Compiling Ijkplayer

On the compilation, I was compiled on Ubuntu after the copy to Win10, Ijkplayer source code needs GCC compilation, windows are not easy to use, if using Cynwin is not as good as compiling under Ubuntu.

The process of compiling is to download SDK,NDK. After setting the environment variable, follow the instructions on GitHub to compile it, and refer to this article for details.

Android Studio Integrated Ijkplayer

1. Import into your project

Android Studio opens your project, File->import Module ... Select the Anroid/ijkplayer directory for Ijkplayer, Ijk-example depends on all libraries, so all items are imported into your project after import.

2. Copy the Tools folder under the Android/ijkplayer directory to the root directory of your project.

3. Create a new folder named Jnilibs in the ijkplayer-java\src\main\ directory, and copy the folders in the \src\main\libs directory in each ijkplayer-xxx directory to the Jnilibs folder. such as: ijkplayer--armv7a The directory contains armeabi-v7a this folder, It contains the. So file for the platform, and if you want to include all of the platforms, copy all of the ijkplayer-xxx, and if you only want a few platforms, only copies them.

4. Remove all ijkplayer-xxx directories from the project, leaving only the Ijkplayer-example, Ijkplayer-java, Ijkplayer-exo, and Tools folders. Where Ijkplayer-example relies on the latter few. The Android Studio Delete project needs to look like the following:

and delete the corresponding folder.

5. Change the Ijkplayer-example to module form, because Ijkplayer-example itself is a application project, the default is not to generate AAR files, and the resources are dependent on each other, It's hard to use the old version by copying the few Java files needed into your project, so instead of converting the entire ijkplayer-example to a module of our project. The specific methods are:

Modify the Build.gradle file in the Ijkplayer-example directory first, as follows:

Apply plugin: ' Com.android.library ' Android {//Http://tools.android.com/tech-docs/new-build-system/tips//noinspect Ion Groovyassignabilitycheck compilesdkversion rootProject.ext.compileSdkVersion//noinspection groovyassignability Check buildtoolsversion rootProject.ext.buildToolsVersion lintoptions {abortonerror false} Defaultcon Fig {minsdkversion 9 targetsdkversion rootProject.ext.targetSdkVersion Versioncode ROOTPROJECT.EXT.V Ersioncode versionname RootProject.ext.versionName} buildtypes {release {minifyenabled F Alse proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro '}} BuildT Oolsversion ' 25.0.0 '}dependencies {compile filetree (include: [' *.jar '], dir: ' Libs ') compile ' com.android.support:a ppcompat-v7:25.0.0 ' compile ' com.android.support:preference-v7:23.0.1 ' compile ' com.android.support: support-annotations:23.0.1 ' Compile ' Com.squareup:otto:1.3.8 ' Compile project (': Ijkplayer-java ') Compile project (': Ijkplayer-exo ')} 

 Attention:

    • Apply plugin: ' com.android.application ' to change to apply plugin: ' Com.android.library '
    • ApplicationID "Tv.danmaku.ijk.media.example" The sentence to be removed
    • Compile ' com.android.support:appcompat-v7:25.0.0 '

Compile ' com.android.support:preference-v7:23.0.1 '

Compile ' com.android.support:support-annotations:23.0.1 '

Compile ' com.squareup:otto:1.3.8 '

These few modifications are for your own installed version.

6. Add a gradle.properties file under the Ijkplayer-example root directory, as follows:

Pom_name=ijkplayer-examplepom_artifact_id=ijkplayer-examplepom_packaging=aar

7. Add the dependencies in your own project as shown in:

To do this, click Async gradle.

Other errors:

If it appears

Error: (3) Error retrieving parent for Item:no Resource found that matches the given name ' Android:TextAppearance.Material . Widget.Button.Borderless.Colored '.

Similar errors, which are caused by the different SDK versions of several projects, four projects contain your own project's compilesdkversion,

Buildtoolsversion, targetsdkversion and compile ' com.android.support:appcompat-v7:25.0.0 '
Several versions must be unified, and if not, there will be a variety of problems.

Android Studio Integrated Ijkplayer

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.