Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local.properties + require a higher Android SDK version #862

Closed
zs-dima opened this issue Jul 1, 2022 · 12 comments
Closed

local.properties + require a higher Android SDK version #862

zs-dima opened this issue Jul 1, 2022 · 12 comments
Labels
platform: android Issue is related to the Android platform. status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. type: bug Something isn't working

Comments

@zs-dima
Copy link

zs-dima commented Jul 1, 2022

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

@Nekketsu-GIT
Copy link

same problem with this version

@JDDV
Copy link
Contributor

JDDV commented Jul 28, 2022

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 JDDV added platform: android Issue is related to the Android platform. status: needs more info We need more information before we can continue work on this issue. type: bug Something isn't working labels Jul 28, 2022
@github-actions
Copy link

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.

@nidegen
Copy link

nidegen commented Sep 11, 2022

please keep it open, I have the same!

@SMDPLAYER
Copy link

I have the same! problem

@nizarzitouni
Copy link

Same problem here

@Thoumar
Copy link

Thoumar commented Oct 9, 2022

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

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

@JDDV JDDV reopened this Oct 10, 2022
@JDDV
Copy link
Contributor

JDDV commented Oct 10, 2022

@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.

@github-actions
Copy link

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.

@joneyspark
Copy link

/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

@ptsdeen2007
Copy link

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

@joneyspark
Copy link

joneyspark commented Oct 30, 2022

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

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

@mvanbeusekom mvanbeusekom added status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. and removed status: needs more info We need more information before we can continue work on this issue. labels Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: android Issue is related to the Android platform. status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants