Форум для тех, кто программирует под Android
Anonymous
ОШИБКА: сборка не удалась с исключением. Где: строка .\flutter.gradle: 912 Что пошло не так: возникла проблема с оценкой
Сообщение
Anonymous » 27 дек 2024, 19:39
Я новичок в Flutter. У меня есть этот проект, и я пытаюсь его выпустить, предполагается, что он готов к выпуску.
Я пытался собрать apk из моего приложения Flutter
Я попробовал сборку Flutter apk
Я получил вот такую ошибку
Код: Выделить всё
FAILURE: Build failed with an exception.
Script 'D:\programs\flutter_windows_3.3.7-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 912
*** What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Could not create task ':app:packLibsflutterBuildRelease'.
> No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [D:\Aqar App\Property\android\app\build\intermediates\flutter\release]**
Это App/build.gradle
Код: Выделить всё
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 FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '2'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '2.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 33
buildToolsVersion "33.0.1"
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "online.propertyforrent"
minSdkVersion 22
targetSdkVersion 33
// versionCode "2"
//versionName "2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['key.jks']
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
/*
debug {
signingConfig signingConfigs.debug
} */
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'com.google.firebase:firebase-analytics:21.2.1'
implementation 'com.google.android.gms:play-services-ads:21.5.0'
// implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.play:integrity:1.1.0'
implementation 'androidx.browser:browser:1.5.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
Это Android/build.gradle
Код: Выделить всё
buildscript {
ext.kotlin_version= '1.8.0'
kotlin_version= '1.8.0'
repositories {
google()
mavenCentral()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.4.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.15'
}
}
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
}
**this is gradle-wrapper.properties**
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
#ddistributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
Это pubspec.yal
Код: Выделить всё
name: houzi
description: Real estate app
publish_to: 'none'
version: 1.0.0+4
environment:
sdk: ">=2.6.0
Подробнее здесь: [url]https://stackoverflow.com/questions/75893312/failure-build-failed-with-an-exception-where-flutter-gradle-line-912-what[/url]
1735317582
Anonymous
[b]Я новичок в Flutter. У меня есть этот проект, и я пытаюсь его выпустить, предполагается, что он готов к выпуску.[/b] [b]Я пытался собрать apk из моего приложения Flutter Я попробовал сборку Flutter apk Я получил вот такую ошибку[/b] [code]FAILURE: Build failed with an exception. Script 'D:\programs\flutter_windows_3.3.7-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 912 *** What went wrong: A problem occurred evaluating root project 'android'. > A problem occurred configuring project ':app'. > Could not create task ':app:packLibsflutterBuildRelease'. > No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [D:\Aqar App\Property\android\app\build\intermediates\flutter\release]** [/code] [b]Это App/build.gradle[/b] [code] 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 FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '2' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '2.0' } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } android { compileSdkVersion 33 buildToolsVersion "33.0.1" sourceSets { main.java.srcDirs += 'src/main/kotlin' } lintOptions { disable 'InvalidPackage' } defaultConfig { applicationId "online.propertyforrent" minSdkVersion 22 targetSdkVersion 33 // versionCode "2" //versionName "2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['key.jks'] storePassword keystoreProperties['storePassword'] } } buildTypes { release { signingConfig signingConfigs.release } } /* debug { signingConfig signingConfigs.debug } */ } flutter { source '../..' } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation 'com.google.firebase:firebase-analytics:21.2.1' implementation 'com.google.android.gms:play-services-ads:21.5.0' // implementation platform('com.google.firebase:firebase-bom:29.0.3') implementation 'com.android.support:multidex:1.0.3' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.play:integrity:1.1.0' implementation 'androidx.browser:browser:1.5.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' } apply plugin: 'com.google.gms.google-services' [/code] [b]Это Android/build.gradle[/b] [code] buildscript { ext.kotlin_version= '1.8.0' kotlin_version= '1.8.0' repositories { google() mavenCentral() mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:7.4.2" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.15' } } 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 } **this is gradle-wrapper.properties** distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip #distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip #ddistributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip [/code] [b]Это pubspec.yal[/b] [code] name: houzi description: Real estate app publish_to: 'none' version: 1.0.0+4 environment: sdk: ">=2.6.0 Подробнее здесь: [url]https://stackoverflow.com/questions/75893312/failure-build-failed-with-an-exception-where-flutter-gradle-line-912-what[/url]