Apparently recent changes with ViewModel affect the internal of Activity which lead to toast throwing BadTokenException in OS 7.1.2. The error is not easily catchable. This library use reflection to override a key function in WindowManager to catch the error. I have audit the code of the library. See https://github.com/PureWriter/ToastCompat for more details
120 lines
3.8 KiB
Groovy
120 lines
3.8 KiB
Groovy
apply plugin: 'com.android.application'
|
|
apply plugin: 'kotlin-android'
|
|
apply plugin: 'kotlin-android-extensions'
|
|
|
|
android {
|
|
compileSdkVersion Integer.parseInt("$compileSdkVer")
|
|
buildToolsVersion buildToolsVer
|
|
|
|
compileOptions {
|
|
targetCompatibility = "8"
|
|
sourceCompatibility = "8"
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId "com.v2ray.ang"
|
|
minSdkVersion 17
|
|
targetSdkVersion Integer.parseInt("$targetSdkVer")
|
|
multiDexEnabled true
|
|
versionCode 212
|
|
versionName "1.0.2"
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
zipAlignEnabled false
|
|
shrinkResources false
|
|
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
}
|
|
debug {
|
|
minifyEnabled false
|
|
zipAlignEnabled false
|
|
shrinkResources false
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main.java.srcDirs += 'src/main/kotlin'
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
splits {
|
|
abi {
|
|
enable true
|
|
reset()
|
|
include 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' //select ABIs to build APKs for
|
|
universalApk true //generate an additional APK that contains all the ABIs
|
|
}
|
|
}
|
|
|
|
// map for the version code
|
|
project.ext.versionCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, 'x86': 3, 'x86_64': 4]
|
|
|
|
android.applicationVariants.all { variant ->
|
|
// assign different version code for each output
|
|
variant.outputs.each { output ->
|
|
output.versionCodeOverride =
|
|
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) *
|
|
1000000 + android.defaultConfig.versionCode
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
testImplementation 'junit:junit:4.13'
|
|
implementation project(':dpreference')
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
|
|
|
|
// Androidx ktx
|
|
implementation 'android.arch.lifecycle:extensions:1.1.1'
|
|
implementation 'android.arch.lifecycle:livedata:1.1.1'
|
|
|
|
// Android support library
|
|
implementation "com.android.support:support-v4:$supportLibVersion"
|
|
implementation "com.android.support:appcompat-v7:$supportLibVersion"
|
|
implementation "com.android.support:design:$supportLibVersion"
|
|
implementation "com.android.support:cardview-v7:$supportLibVersion"
|
|
implementation "com.android.support:preference-v7:$supportLibVersion"
|
|
implementation "com.android.support:recyclerview-v7:$supportLibVersion"
|
|
implementation "com.android.support:multidex:1.0.3"
|
|
implementation 'com.android.support.constraint:constraint-layout:2.0.1'
|
|
|
|
// DSL
|
|
implementation 'com.google.code.gson:gson:2.8.6'
|
|
implementation 'io.reactivex:rxjava:1.3.4'
|
|
implementation 'io.reactivex:rxandroid:1.2.1'
|
|
implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar'
|
|
implementation 'me.dm7.barcodescanner:core:1.9.8'
|
|
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
|
|
implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
|
|
implementation 'me.drakeet.support:toastcompat:1.1.0'
|
|
|
|
implementation(name: 'libv2ray', ext: 'aar')
|
|
//implementation(name: 'tun2socks', ext: 'aar')
|
|
}
|
|
|
|
buildscript {
|
|
repositories {
|
|
google()
|
|
jcenter()
|
|
maven { url 'https://maven.google.com' }
|
|
}
|
|
dependencies {
|
|
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion"
|
|
}
|
|
}
|
|
repositories {
|
|
flatDir {
|
|
dirs 'libs'
|
|
}
|
|
}
|