apply plugin: 'com.android.application' repositories { mavenCentral() jcenter() } task nativeLibsToJar( type: Zip, description: 'create a jar archive of the native libs') { destinationDir file("$buildDir/native-libs") baseName 'native-libs' extension 'jar' from fileTree(dir: 'libs', include: '**/*.so') into 'lib/' } tasks.withType(JavaCompile) { options.encoding = "UTF-8" } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn(nativeLibsToJar) } dependencies { compile 'com.android.support:appcompat-v7:25.1.1' compile 'com.googlecode.mp4parser:isoparser:1.0.6' compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar') } android { compileSdkVersion 25 buildToolsVersion '25.0.2' useLibrary 'org.apache.http.legacy' defaultConfig.applicationId = "com.b44t.messenger" compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } lintOptions { abortOnError false } signingConfigs { debug { storeFile file("config/debug.keystore") } release { storeFile file("config/release.keystore") storePassword RELEASE_STORE_PASSWORD keyAlias RELEASE_KEY_ALIAS keyPassword RELEASE_KEY_PASSWORD } } buildTypes { debug { debuggable true jniDebuggable true signingConfig signingConfigs.debug applicationIdSuffix ".beta" } release { debuggable false jniDebuggable false signingConfig signingConfigs.release minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } defaultConfig.versionCode = 22 sourceSets.main { jniLibs.srcDir 'libs' jni.srcDirs = [] //disable automatic ndk-build call } productFlavors { /* x86 { ndk { abiFilter "x86" } versionCode = 2 } arm { ndk { abiFilter "armeabi" } versionCode = 0 } armv7 { ndk { abiFilter "armeabi-v7a" } versionCode = 1 } */ fat { versionCode = 3 } } applicationVariants.all { variant -> def abiVersion = variant.productFlavors.get(0).versionCode variant.mergedFlavor.versionCode = defaultConfig.versionCode * 10 + abiVersion; } defaultConfig { minSdkVersion 14 // 14: Android 4.0 Ice Cream Sandwich 2011 (Telegram default), 21: Android 5.0 Lollipop 2014 (recommended for InstantRun) targetSdkVersion 25 // 25: Nougat. CAVE: Do NOT target "Andoid O" without checking the background tasks carefully, see https://developer.android.com/preview/behavior-changes.html#back-all . As long as we target "Nougat", everything works as expected even for "Andoid O" or later versionName "0.1.23" // do NOT forget to increase defaultConfig.versionCode! } }