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

A problem occurred evaluating settings 'android' #799

Open
RebinX1 opened this issue Dec 9, 2024 · 6 comments
Open

A problem occurred evaluating settings 'android' #799

RebinX1 opened this issue Dec 9, 2024 · 6 comments

Comments

@RebinX1
Copy link

RebinX1 commented Dec 9, 2024

I am trying to install and build a basic mapbox flutter app, the app runs well on IOS and i have no issue as i have followed the docs, but when i try to run the same app on android i get this error:

`flutter run
Launching lib/main.dart on Pixel 6 in debug mode...

FAILURE: Build failed with an exception.

  • Where:
    Settings file '/Users/rebin/Documents/OrbitalPoint.Co/Company Project/Cee/Apps/Cee-Flutter/cee_radar_and_navigation/android/settings.gradle' line: 25

  • What went wrong:
    A problem occurred evaluating settings 'android'.

Could not get unknown property 'project' for Credentials [username: mapbox] of type org.gradle.internal.credentials.DefaultPasswordCredentials_Decorated.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 395ms
Running Gradle task 'assembleDebug'... 935ms
Error: Gradle task assembleDebug failed with exit code 1`

i have followed the documentation and i have checked other people who had a somehow of a similar issue but none fixed the android issue i have right now.

i am using flutter "2.4.1", on android these are the setup that i currently have:

android/app/main/res/values/mapbox_access_token:

`

pk.eyJ1Ij...... `

android/app/build.gradle:

`
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

android {
namespace = "com.orbitalpoint.cee_radar_and_navigation"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = JavaVersion.VERSION_1_8
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId = "com.orbitalpoint.cee_radar_and_navigation"
    // You can update the following values to match your application needs.
    // For more information, see: https://flutter.dev/to/review-gradle-config.
    minSdk = flutter.minSdkVersion
    targetSdk = flutter.targetSdkVersion
    versionCode = flutter.versionCode
    versionName = flutter.versionName
}

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 = "../.."
}
`

android/gradle.properties:

org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true MAPBOX_DOWNLOADS_TOKEN=sk.ey...

android/settings.gradle:
`pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
    google()
    mavenCentral()
    gradlePluginPortal()

    // Mapbox Maven repository
    maven {
        url 'https://api.mapbox.com/downloads/v2/releases/maven'>
        authentication {
            basic(BasicAuthentication)
        }
        credentials {
            username = "mapbox"
            password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
        }
    }

}

}

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

include ":app"

`

On IOS i have no issue and the app works and it display the mapbox map widget, but on android the app does not run at all, am i missing something or have i messed up the implementation?

i am using the latest version of flutter and mapbox library.

@evil159
Copy link
Contributor

evil159 commented Dec 9, 2024

@RebinX1 Could you try removing credentials { ... section from your settings.gradle?

@RebinX1
Copy link
Author

RebinX1 commented Dec 9, 2024

@evil159 i removed the credential and i got this error:

`FAILURE: Build failed with an exception.

  • Where:
    Settings file '/Users/rebin/Documents/OrbitalPoint.Co/Company Project/Cee/Apps/Cee-Flutter/cee_radar_and_navigation/android/settings.gradle' line: 27

  • What went wrong:
    Error resolving plugin [id: 'com.android.application', version: '8.1.0', apply: false]

Could not resolve all dependencies for configuration 'detachedConfiguration1'.
You cannot configure authentication schemes for this repository type if no credentials are provided.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 390ms`

This how my settings.gradle looks like now:

`

pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
    maven {
        url 'https://api.mapbox.com/downloads/v2/releases/maven'
        authentication {
            basic(BasicAuthentication)
        }
    }
}

}

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

include ":app"

`

@evil159
Copy link
Contributor

evil159 commented Dec 10, 2024

@RebinX1, sorry forgot to mention, authentication section should be removed as well

@RebinX1
Copy link
Author

RebinX1 commented Dec 10, 2024

@evil159 i have tried removing the authentication my setting.gradle looks like this, but i still get the same error, i have alsi removed the full maven{..} for the mapbox implementation and the error remains.

`
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
    maven {
        url 'https://api.mapbox.com/downloads/v2/releases/maven'
        credentials {
            username = "mapbox"
            password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
        }
    }
}

}

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

include ":app"

`

Error:

`
FAILURE: Build failed with an exception.

  • Where:
    Settings file '/Users/rebin/Documents/OrbitalPoint.Co/Company Project/Cee/Apps/Cee-Flutter/cee_radar_and_navigation/android/settings.gradle' line: 20

  • What went wrong:
    A problem occurred evaluating settings 'android'.

Could not get unknown property 'project' for Credentials [username: mapbox] of type org.gradle.internal.credentials.DefaultPasswordCredentials_Decorated.
`

its worth to mention when i remove the full maven{..} i get this error:

`

  • What went wrong:
    A problem occurred configuring project ':mapbox_maps_flutter'.

Failed to notify project evaluation listener.
Could not get unknown property 'android' for project ':mapbox_maps_flutter' of type org.gradle.api.Project.
Could not find method implementation() for arguments [project ':flutter_plugin_android_lifecycle'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Could not get unknown property 'android' for project ':mapbox_maps_flutter' of type org.gradle.api.Project.

`

@evil159
Copy link
Contributor

evil159 commented Dec 11, 2024

@RebinX1 I see, could you try downgrading AGP(com.android.application in your case) to version 7.x, e.g. 7.3.0? 8 should be supported, but still something to try.

@RebinX1
Copy link
Author

RebinX1 commented Dec 11, 2024

@evil159 i tried this, i had to downgrade my java version from (20 to 17), i tried to run my app and the issue remains, i have restored my flutter app and i have pushed it to github available at this link "https://github.com/RebinX1/Cee-Flutter", i would appreciate if you can look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants