• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Flutter 게시판 플러터 안드로이드 빌드 앱번들 오류

플러터 안드로이드 빌드 앱번들 오류

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 글쓴이
  • #92912

    김윤호
    참가자
    플러터에서 빌드 앱번들을 누르면 아래와 같은 오류가 나옵니다.
    (오류가 계속 나서 flutter clean, flutter pub get을 실행한 후 에러코드입니다)
    build appbundle
    Running Gradle task 'bundleRelease'...
    FAILURE: Build failed with an exception.
    * Where:
    Script '/Users/yunho/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 80
    * What went wrong:
    A problem occurred evaluating script.
    > Could not find method android() for arguments [flutter_czasxc8v9tzqw71tiferzrnkg$_run_closure1@29b36b15] on project ':app' of type org.gradle.api.Project.
    * 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 322ms
    Running Gradle task 'bundleRelease'...                             818ms
    Gradle task bundleRelease failed with exit code 1
    Process finished with exit code 1
    
    Script '/Users/yunho/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 80 해당코드는
    "
    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    " 여기 부분입니다.
    
    
    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 = '1'
    }
    def flutterVersionName = localProperties.getProperty('flutter.versionName')
    if (flutterVersionName == null) {
        flutterVersionName = '1.0'
    }
    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'com.google.gms.google-services'
    apply plugin: 'kotlin-android-extensions'
    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 {
        signingConfigs {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
                storePassword keystoreProperties['storePassword']
            }
        }
        compileSdkVersion 34
        buildToolsVersion "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.easylife.el_sports"
            // 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 21
            targetSdkVersion 34
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
            multiDexEnabled true
        }
        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.release
            }
        }
    }
    flutter {
        source '../..'
    }
    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation "androidx.multidex:multidex:$multidex_version"
        implementation platform('com.google.firebase:firebase-bom:30.2.0')
        implementation 'com.google.firebase:firebase-analytics'
        implementation 'com.google.firebase:firebase-messaging'
    }
    "
    
    android/build.gradle
    "
    
    buildscript {
        ext.kotlin_version = '1.7.21'
        ext.multidex_version = '2.0.1'
        repositories {
            google()
            mavenCentral()
        }
        dependencies {
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.android.tools.build:gradle:7.2.2'
            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')
    }
    tasks.register("clean", Delete) {
        delete rootProject.buildDir
    }
    "
    
    gradle-wapper.properties
    "
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
    "
    
    key.properties(비빌번호는 *처리)
    "
    storePassword=***
    keyPassword=***
    keyAlias=upload
    storeFile=/Desktop/Programming/flutter/el_sports/flutter_keys/upload-keystore.jks
    "
    
    이 오류때문에 거의한 3일을 맨땅에 해딩한 것 같은데 결국 해결하지 못했습니다
    어떻게 해결해야될까요?
    #92930

    김윤호
    참가자
    에러코드과 다음과 같이 변경되었습니다.
    
    unning Gradle task 'bundleRelease'...                          
    Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1756 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
    FAILURE: Build completed with 2 failures.
    1: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':app:validateSigningRelease'.
    > Keystore file '/Desktop/Programming/flutter/el_sports/flutter_keys/upload-keystore.jks' not found for signing config 'release'.
    * 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.
    ==============================================================================
    2: Task failed with an exception.
    -----------
    * What went wrong:
    java.lang.StackOverflowError (no error message)
    * 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 2s
    Running Gradle task 'bundleRelease'...                           2,953ms
    Gradle task bundleRelease failed with exit code 1
    Process finished with exit code 1
    #92931

    김윤호
    참가자
    해결 완료했습니다
    혹시라도 맥 쓰시는 분들중에
    Execution failed for task ':app:validateSigningRelease'.
    > Keystore file '/Desktop/Programming/flutter/el_sports/flutter_keys/upload-keystore.jks' not found for signing config 'release'.
    오류가 뜬다면
    key.properties파일에서
    storeFile위치를 /부터 시작해서 처음 파일위치부터 정해주지 말고
    기본위치가 flutter파일/android/app이니 여기 에다가 폴더 하나 생성해 주시고 그 안에 키파일 넣으시면 됩니다.
    저 같은 경우는 이렇게했습니다
    storeFile=flutter_keys/upload-keystore.jks
    
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠