flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

local.properties + require a higher Android SDK version

Open zs-dima opened this issue 2 years ago • 2 comments

however local.properties set compileSdkVersion to 33

flutter.compileSdkVersion=33 compiling warning appears:

One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to C:\Source\Neorise\jkapp\jkapp\android\app\build.gradle:
android {
  compileSdkVersion 33
  ...
}

permission_handler version 10.0.0

zs-dima avatar Jul 01 '22 07:07 zs-dima

same problem with this version

Nekketsu-GIT avatar Jul 08 '22 14:07 Nekketsu-GIT

Hi @zs-dima, @Nekketsu-GIT I have tried adding the permission handler 10.0.0 and changed my android > app > build.gradle according to what the error says. For me it worked.

My build.gradle looks like this now:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.test_app"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

Have you tried rebuilding your project? maybe it's a caching issue somehow?

Let me know if it helped so I can close the issue!

JDDV avatar Jul 28 '22 14:07 JDDV

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

github-actions[bot] avatar Aug 11 '22 16:08 github-actions[bot]

please keep it open, I have the same!

nidegen avatar Sep 11 '22 22:09 nidegen

I have the same! problem

SMDPLAYER avatar Sep 21 '22 14:09 SMDPLAYER

Same problem here

nizarzitouni avatar Oct 01 '22 22:10 nizarzitouni

Adding these lines inside android/local.properties file solved the issue for me:

flutter.minSdkVersion=33
flutter.targetSdkVersion=33
flutter.compileSdkVersion=33

Thoumar avatar Oct 09 '22 15:10 Thoumar

@Thoumar minSdkVersion should not be flutter.minSdkVersion = 33 in most cases, and probably wont fix this issue. It should only be 33 if your app only targets API level 33 Android devices. You can use flutter.minimumSdkVersion constant if you want to target the lowest API level possible (right now it's set to 16 I believe, but can change in the future). elsewise the minSdkVersion should be the lowest API level you want to be supported by your app.

For the people still having this problem; please send your build.gradle file so I can see if there's something wrong, since I can't reproduce this issue.

JDDV avatar Oct 10 '22 13:10 JDDV

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

github-actions[bot] avatar Oct 10 '22 13:10 github-actions[bot]

/your_project/android/local.properties file add flutter.compileSdkVersion=33 this line and /your_project/android/app/build.gradle for this file update with below code

android {
    // compileSdkVersion flutter.compileSdkVersion
    compileSdkVersion localProperties.getProperty('flutter.compileSdkVersion').toInteger()
}

update your compileSdkVersion and comment the older one

it works for me

Thanks

joneyspark avatar Oct 22 '22 09:10 joneyspark

please watch this video https://youtu.be/itluFkwTUwY

ptsdeen2007 avatar Oct 30 '22 05:10 ptsdeen2007

please watch this video https://youtu.be/itluFkwTUwY

@ptsdeen2007 always better to avoid hard code. Use local.properties variable. it's flutter recommended. Thanks

joneyspark avatar Oct 30 '22 10:10 joneyspark