90 lines
2.7 KiB
Groovy
90 lines
2.7 KiB
Groovy
import groovy.xml.XmlUtil
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'kotlin-android'
|
|
apply plugin: 'kotlin-android-extensions'
|
|
|
|
android {
|
|
|
|
compileSdkVersion 28
|
|
buildToolsVersion '28.0.3'
|
|
|
|
defaultConfig {
|
|
minSdkVersion 26
|
|
targetSdkVersion 28
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
}
|
|
}
|
|
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
compileOptions {
|
|
targetCompatibility 1.8
|
|
sourceCompatibility 1.8
|
|
}
|
|
|
|
// optional signingConfigs
|
|
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
|
if (keystorePropertiesFile.exists()) {
|
|
def keystoreProperties = new Properties()
|
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
|
|
|
signingConfigs {
|
|
release {
|
|
keyAlias keystoreProperties['keyAlias']
|
|
keyPassword keystoreProperties['keyPassword']
|
|
storeFile file(keystoreProperties['storeFile'])
|
|
storePassword keystoreProperties['storePassword']
|
|
}
|
|
}
|
|
buildTypes.release.signingConfig = signingConfigs.release
|
|
}
|
|
}
|
|
|
|
gradle.projectsEvaluated {
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs.add('-Xbootclasspath/p:app/libs/android.jar:app/libs/libcore.jar')
|
|
}
|
|
}
|
|
|
|
// http://www.31mins.com/android-studio-build-system-application/
|
|
preBuild.doLast {
|
|
def imlFile = file(project.name + ".iml")
|
|
|
|
try {
|
|
def parsedXml = (new XmlParser()).parse(imlFile)
|
|
def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
|
|
parsedXml.component[1].remove(jdkNode)
|
|
|
|
def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
|
|
new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
|
|
XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
|
|
|
|
} catch (NullPointerException | FileNotFoundException ex) {
|
|
ex.printStackTrace()
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// To produce these binaries, in latest AOSP source tree, run
|
|
// $ make
|
|
compileOnly fileTree(include: [
|
|
// out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
|
|
'android.jar',
|
|
// out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar
|
|
'libcore.jar'
|
|
], dir: 'libs')
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
|
|
implementation 'commons-io:commons-io:2.6'
|
|
|
|
implementation "androidx.core:core-ktx:1.0.2"
|
|
implementation 'androidx.preference:preference-ktx:1.0.0'
|
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
|
|
}
|