this is my app\build.gradle file..........................
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 31
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.ccounterr"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion 31
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 '../..'
}
**this is my android\build.gradle file.............................**
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
rootProject.allprojects {
configurations.all {
resolutionStrategy {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core') {
details.useVersion "1.0.2"
}
if (details.requested.group == 'androidx.lifecycle') {
details.useVersion "2.0.0"
}
if (details.requested.group == 'androidx.versionedparcelable') {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.fragment') {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.appcompat') {
details.useVersion "1.0.1"
}
if (details.requested.group == 'androidx.annotation') {
details.useVersion "1.0.2"
}
}
}
}
}
this is error when running on android device.
Launching lib\main.dart on RMX1831 in debug mode...
Running Gradle task 'assembleDebug'...
[Fatal Error] tracing-1.0.0.pom:2:1: Content is not allowed in prolog.
[Fatal Error] window-java-1.0.0-beta04.pom:2:1: Content is not allowed in prolog.
[Fatal Error] loader-1.0.0.pom:2:1: Content is not allowed in prolog.
[Fatal Error] customview-1.0.0.pom:2:1: Content is not allowed in prolog.
[Fatal Error] viewpager-1.0.0.pom:2:1: Content is not allowed in prolog.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve androidx.tracing:tracing:1.0.0.
Required by:
project :app > io.flutter:flutter_embedding_debug:1.0.0-1837b5be5f0f1376a1ccf383950e83a80177fb4e
> Could not resolve androidx.tracing:tracing:1.0.0.
> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/tracing/tracing/1.0.0/tracing-1.0.0.pom
> Content is not allowed in prolog.
> Could not resolve androidx.window:window-java:1.0.0-beta04.
Required by:
project :app > io.flutter:flutter_embedding_debug:1.0.0-1837b5be5f0f1376a1ccf383950e83a80177fb4e
> Could not resolve androidx.window:window-java:1.0.0-beta04.
> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/window/window-java/1.0.0-beta04/window-java-1.0.0-beta04.pom
> Content is not allowed in prolog.
> Could not resolve androidx.loader:loader:1.0.0.
Required by:
project :app > io.flutter:flutter_embedding_debug:1.0.0-1837b5be5f0f1376a1ccf383950e83a80177fb4e > androidx.fragment:fragment:1.0.0
project :app > io.flutter:flutter_embedding_debug:1.0.0-1837b5be5f0f1376a1ccf383950e83a80177fb4e > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-utils:1.0.0
> Could not resolve androidx.loader:loader:1.0.0.
> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/loader/loader/1.0.0/loader-1.0.0.pom
> Content is not allowed in prolog.
> Could not resolve androidx.customview:customview:1.0.0.
Required by:
project :app > io.flutter:flutter_embedding_debug:1.0.0-1837b5be5f0f1376a1ccf383950e83a80177fb4e > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0
project :app > io.flutter:flutter_embedding_debug:1.0.0-1837b5be5f0f1376a1ccf383950e83a80177fb4e > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.coordinatorlayout:coordinatorlayout:1.0.0
project :app > io.flutter:flutter_embedding_debug:1.0.0-1837b5be5f0f1376a1ccf383950e83a80177fb4e > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.drawerlayout:drawerlayout:1.0.0
project :app > io.flutter:flutter_embedding_debug:1.0.0-1837b5be5f0f1376a1ccf383950e83a80177fb4e > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.slidingpanelayout:slidingpanelayout:1.0.0
> Could not resolve androidx.customview:customview:1.0.0.
> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/customview/customview/1.0.0/customview-1.0.0.pom
> Content is not allowed in prolog.
> Could not resolve androidx.viewpager:viewpager:1.0.0.
Required by:
project :app > io.flutter:flutter_embedding_debug:1.0.0-1837b5be5f0f1376a1ccf383950e83a80177fb4e > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0
> Could not resolve androidx.viewpager:viewpager:1.0.0.
> Could not parse POM https://dl.google.com/dl/android/maven2/androidx/viewpager/viewpager/1.0.0/viewpager-1.0.0.pom
> Content is not allowed in prolog.
* 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 26s
Exception: Gradle task assembleDebug failed with exit code 1
>I have tried these things
- I tried upgrading the gradle url in gradle wrapper.properties file.
- I tried changing my compilesdk version 31.
- I tried chnaging my tragetsdk version to 31.............................
It is ruuning properly on web