buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.0' } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } task preProcessRes(type: Exec) { executable "sh" args "resPreprocess.sh" } apply plugin: 'com.android.application' task ndkLibsToJar(type: Zip, dependsOn: 'ndkBuild', description: 'Create a JAR of the native libs') { destinationDir new File(buildDir, 'libs') baseName 'ndk-libs' extension 'jar' println(buildDir) from(new File(buildDir, 'libs')) { include '**/*.so' } into 'lib/' } task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') { commandLine "$android.ndkDirectory/ndk-build", 'NDK_PROJECT_PATH=build', 'APP_BUILD_SCRIPT=jni/Android.mk', 'NDK_APPLICATION_MK=jni/Application.mk' } tasks.withType(org.gradle.api.tasks.compile.JavaCompile) { compileTask -> compileTask.dependsOn ndkLibsToJar } android { compileSdkVersion 'android-24' buildToolsVersion "24.0.1" preBuild.dependsOn preProcessRes defaultConfig { applicationId "com.android.gallery3d" testApplicationId "com.android.gallery3d.tests" minSdkVersion 16 targetSdkVersion 24 versionCode 40030 versionName "1.1.40030" renderscriptTargetApi 18 multiDexEnabled true jackOptions { enabled true } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } dexOptions { incremental true maxProcessCount 4 javaMaxHeapSize "2g" } lintOptions { abortOnError false } aaptOptions { cruncherEnabled false } buildTypes { debug { minifyEnabled false } release { minifyEnabled true } } sourceSets { main { // Using res dir that generated by preProcessRes task, rather than original res dir. // if can not find build/res when build, run Gradle projects->Tasks->other->preProcessRes res.srcDirs = ['build/res'] java.srcDirs = ['src', 'src_pd', 'ext/src', 'gallerycommon/src'] renderscript.srcDirs = ['src'] manifest.srcFile 'AndroidManifest.xml' } // build test apk, do not remove androidTest { manifest.srcFile "../../../vendor/mediatek/proprietary/tests/packages/apps/Gallery2" + "/AndroidManifest.xml" res.srcDirs = ["../../../vendor/mediatek/proprietary/tests/packages/apps/Gallery2/res"] java.srcDirs = ["../../../vendor/mediatek/proprietary/tests/packages/apps/Gallery2" + "/src"] java.excludes = ["**/Gallery2LaunchPerformance.java", "**/StereoStressTestCase.java"] } } afterEvaluate { assembleDebug.dependsOn assembleDebugAndroidTest } dependencies { // android library compile 'com.android.support:support-v13:23.0.0' compile files("$sdkDirectory/build-tools/$buildToolsVersion/renderscript/lib/renderscript-v8.jar") // local library compile files('lib/xmp_toolkit.jar') compile files('lib/mp4parser.jar') compile files('lib/com.mediatek.omadrm.common.jar') compile files('lib/com.mediatek.galleryportable.jar') compile files('lib/appluginmanager.jar') // include so library in apk compile files("build/libs/ndk-libs.jar") // local project compile project(':mediatek:basic') // library that test apk needed, do not remove androidTestCompile 'org.mockito:mockito-core:1.10.19' androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2' androidTestCompile fileTree('../../../vendor/mediatek/proprietary/tests/packages/apps/Gallery2/libs') androidTestCompile files('lib/com.mediatek.galleryportable.jar') } useLibrary "org.apache.http.legacy" }