|
1 | 1 | apply plugin: 'com.android.application' |
| 2 | +import org.apache.tools.ant.taskdefs.condition.Os |
2 | 3 |
|
3 | 4 | def getGitHubCommit = { |
4 | 5 | try { |
@@ -86,10 +87,16 @@ android { |
86 | 87 | release { |
87 | 88 | buildConfigField "String", "GITHUB_COMMIT", "\"${getGitHubCommit()}\"" |
88 | 89 | buildConfigField "String", "SOURCE_CODE", "\"https://github.com/openvk/mobile-android-legacy\"" |
| 90 | + ndk { |
| 91 | + abiFilters 'x86', 'armeabi', 'armeabi-v7a', 'arm64-v8a' |
| 92 | + } |
89 | 93 | } |
90 | 94 | debug { |
91 | 95 | buildConfigField "String", "GITHUB_COMMIT", "\"${getGitHubCommit()}\"" |
92 | 96 | buildConfigField "String", "SOURCE_CODE", "\"https://github.com/openvk/mobile-android-legacy\"" |
| 97 | + ndk { |
| 98 | + abiFilters 'x86', 'armeabi', 'armeabi-v7a', 'arm64-v8a' |
| 99 | + } |
93 | 100 | } |
94 | 101 | } |
95 | 102 | productFlavors { |
@@ -130,6 +137,33 @@ android { |
130 | 137 | sourceCompatibility JavaVersion.VERSION_1_7 |
131 | 138 | targetCompatibility JavaVersion.VERSION_1_7 |
132 | 139 | } |
| 140 | + task mPlayerBuild(type: Exec, description: 'Compile OpenVK Media Player via NDK') { |
| 141 | + def ndkDir = android.ndkDirectory |
| 142 | + def projDir = project.projectDir.toString() |
| 143 | + println "Compiling OpenVK Media Player..." |
| 144 | + println "Project Directory: ${projDir}" |
| 145 | + if (Os.isFamily(Os.FAMILY_WINDOWS)) { |
| 146 | + commandLine "$ndkDir\\ndk-build.cmd", |
| 147 | + "NDK_PROJECT_PATH=$projDir/app/src/main", |
| 148 | + "NDK_LIBS_OUT=$projDir/app/src/main/jniLibs", |
| 149 | + "APP_BUILD_SCRIPT=$projDir/../ndk-modules/ovkmplayer/Android.mk", |
| 150 | + "NDK_APPLICATION_MK=$projDir/../ndk-modules/ovkmplayer/Application.mk" |
| 151 | + } else { |
| 152 | + commandLine "$ndkDir/ndk-build.sh", |
| 153 | + "NDK_PROJECT_PATH=$projDir/app/src/main", |
| 154 | + "NDK_LIBS_OUT=$projDir/app/src/main/jniLibs", |
| 155 | + "APP_BUILD_SCRIPT=$projDir/ndk-modules/ovkmplayer/Android.mk", |
| 156 | + "NDK_APPLICATION_MK=$projDir/ndk-modules/ovkmplayer/Application.mk" |
| 157 | + } |
| 158 | + } |
| 159 | + tasks.withType(JavaCompile) { |
| 160 | + compileTask -> compileTask.dependsOn mPlayerBuild |
| 161 | + } |
| 162 | + externalNativeBuild { |
| 163 | + ndkBuild { |
| 164 | + path '../ndk-modules/ovkmplayer/Android.mk' |
| 165 | + } |
| 166 | + } |
133 | 167 | } |
134 | 168 |
|
135 | 169 | dependencies { |
|
0 commit comments