1// Copyright 2016, 2018 Google Inc. All rights reserved. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15apply plugin: 'com.android.application' 16 17def ndkDir 18if (project.rootProject.file('local.properties').exists()) { 19 Properties properties = new Properties() 20 properties.load(project.rootProject.file('local.properties').newDataInputStream()) 21 ndkDir = properties.getProperty('ndk.dir') 22} 23if (!ndkDir) { 24 ndkDir=System.getenv("ANDROID_NDK_HOME") 25} 26 27if(!ndkDir || ndkDir.empty) { 28 throw new GradleException('Environment Variable ANDROID_NDK_HOME for NDK path need to be setup') 29} 30 31 32def stlType = 'c++_static' 33 34android { 35 compileSdkVersion 26 36 37 defaultConfig { 38 applicationId 'com.samples.cube' 39 minSdkVersion 24 // Official vulkan support starts in version 24 40 targetSdkVersion 26 41 versionCode 1 42 versionName '0.0.1' 43 ndk { 44 abiFilters 'armeabi-v7a' 45 } 46 externalNativeBuild { 47 cmake { 48 arguments "-DANDROID_PLATFORM=android-24" 49 arguments "-DANDROID_TOOLCHAIN=clang" 50 arguments "-DANDROID_STL=${stlType}" 51 arguments "-DSAMPLE_NAME=" + project.getName() 52 } 53 } 54 } 55 externalNativeBuild { 56 cmake { 57 path 'CMakeLists.txt' 58 } 59 } 60 buildTypes { 61 release { 62 minifyEnabled false 63 proguardFiles getDefaultProguardFile('proguard-android.txt'), 64 'proguard-rules.pro' 65 } 66 } 67} 68 69dependencies { 70 implementation fileTree(dir: 'libs', include: ['*.jar']) 71} 72