From 443e3efd4e68e0bc3934edcca9d106433bc15a22 Mon Sep 17 00:00:00 2001 From: rostopira Date: Thu, 2 Aug 2018 18:35:16 +0300 Subject: [PATCH] Fix for MagiskSU --- app/build.gradle | 14 +++++--------- .../java/ua/rostopira/headsswitch/TileService.kt | 4 +++- build.gradle | 6 ++++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0ff8996..e3a897c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,17 +2,13 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion 28 defaultConfig { applicationId "ua.rostopira.headsswitch" minSdkVersion 24 - targetSdkVersion 25 - versionCode 1 - versionName "1.0" - jackOptions { - enabled true - } + targetSdkVersion 27 + versionCode 2 + versionName "2.0" } buildTypes { release { @@ -27,7 +23,7 @@ android { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" } repositories { mavenCentral() diff --git a/app/src/main/java/ua/rostopira/headsswitch/TileService.kt b/app/src/main/java/ua/rostopira/headsswitch/TileService.kt index 65a6f64..dbd02c0 100644 --- a/app/src/main/java/ua/rostopira/headsswitch/TileService.kt +++ b/app/src/main/java/ua/rostopira/headsswitch/TileService.kt @@ -29,8 +29,10 @@ class HeadsUpSwitcher: TileService() { isEnabled = !isEnabled } - private fun getPermission() = + private fun getPermission() { Runtime.getRuntime().exec("""su -c 'pm grant ${BuildConfig.APPLICATION_ID} $WRITE_SECURE_SETTINGS'""") + Runtime.getRuntime().exec("""su -c pm grant ${BuildConfig.APPLICATION_ID} $WRITE_SECURE_SETTINGS""") + } private fun setTileState(state: Boolean = isEnabled) { if (state) { diff --git a/build.gradle b/build.gradle index 593cbfa..c0b0581 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.1.0' + ext.kotlin_version = '1.2.51' repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0' + classpath 'com.android.tools.build:gradle:3.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -14,6 +15,7 @@ buildscript { allprojects { repositories { jcenter() + google() } }