FLUTH:无法在调试或发布中构建Android [英] Flutter : can't build android in debug or release

查看:115
本文介绍了FLUTH:无法在调试或发布中构建Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

突然我的应用程序无法在调试或发布模式下运行。 我在UI中添加了一些屏幕,但没有更改或添加任何包。 我不知道具体发生了什么,但我已经尝试在Android Studio中用本地历史撤销我的更改,但也没有任何反应。

我的输出是:

    FAILURE: Build completed with 2 failures.

     1: Task failed with an exception.
     -----------
     * Where:
     Build file '/Users/mackbookpro/.pub- 
     cache/hosted/pub.dartlang.org/flutter_mapbox_navigation-0.0.24/android/build.gradle' 
     line: 31

   * What went wrong:
A problem occurred evaluating project ':flutter_mapbox_navigation'.
> Basedir /Users/mackbookpro/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_web-0.2.1+2/android does not exist

* 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.
-----------
* Where:
Script '/Users/mackbookpro/Desktop/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 346

* What went wrong:
A problem occurred configuring project ':flutter_mapbox_navigation'.
> Could not get unknown property 'android' for project ':flutter_mapbox_navigation' 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 4s
Exception: Gradle task assembleDebug failed with exit code 1

扑动医生日志:

[✓] Flutter (Channel beta, 2.2.0, on Mac OS X 10.15.7 19H111 darwin-x64, locale en-EG)
    • Flutter version 2.2.0 at /Users/mackbookpro/Desktop/development/flutter
    • Framework revision b22742018b (4 weeks ago), 2021-05-14 19:12:57 -0700
    • Engine revision a9d88a4d18
    • Dart version 2.13.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/mackbookpro/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.56.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • Infinix X650D (mobile) • 05254259CA004636 • android-arm64  • Android 9 (API 28)
    • Chrome (web)           • chrome           • web-javascript • Google Chrome 91.0.4472.77

• No issues found!
Process finished with exit code 0

我已尝试删除.gradle文件,但没有任何反应。

已编辑。 我的pubsec.yaml:

name: app
description: Application

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.0.8+28

environment:
  sdk: ">=2.11.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0

  #Checkboxes Library
  grouped_buttons: ^1.0.4

  #Google Maps Library.
  google_maps_flutter: ^0.5.28+1

  #Flutter Map Picker
  google_map_location_picker: ^3.3.3

  #Flutter GeoLocator
  geolocator: 5.3.2+2

  #Flutter Permissions
  permission: ^0.1.7

  #Flutter Lottie Animations
  lottie: ^0.7.0+1

  #Flutter Numeric Keyboard
  numeric_keyboard: ^1.0.0

  #Flutter Curved Navigation Drawer
  curved_navigation_bar: ^0.3.3

  #Flutter Drop Down Field
  dropdownfield: ^1.0.3

  #Flutter BLOC
  flutter_bloc: ^6.0.1

  #Flutter EQUATABLE
  equatable: ^1.0.2

  #Flutter DIO
  dio: ^3.0.9

  #Json Serialization
  json_annotation: ^3.0.1

  #Flutter Validator
  validators: ^2.0.0+1

  #Flutter SharedPrefs
  shared_preferences: ^0.5.8

  #Flutter Poly Lines
  flutter_polyline_points: ^0.2.2

  #FLutter Location Library
  location: ^3.2.4

  #Flutter Map PolyLine
  google_map_polyline:

  #Flutter Google Fonts
  google_fonts: ^1.1.0

  #Flutter Progress Dialog
  progress_dialog: ^1.2.4

  #Flutter Toast
  toast: ^0.1.5

  #rxDart
  rxdart: ^0.25.0

  #GET NAVIGATOR
  get: ^3.5.1


  #FLUTTER SLIDING CARD
  sliding_card: ^0.1.2


  #FLUTTER PERMISSIONS HANDLER
  permission_handler: ^5.0.1+1

  #FLUTTER BUTTON SLIDER
  slider_button: ^0.6.0

  #FLUTTER RADIO GROUP
  group_radio_button: ^1.0.1

  #FLUTTER MATERIAL COLOR
  material_design_icons_flutter: ^4.0.5855

  #FLUTTER DROPDOWN FIELD
  dropdown_formfield: ^0.1.3

  #FLUTTER TOGGLE SWITCH
  toggle_switch: ^0.1.8

  #FUTTER CHAT
  flutter_chat: ^1.1.0

  #FLUTTER SLIDE BUTTON
  slide_button: ^0.2.8

  #FLUTTER MAPBOX NAVIGATION
  flutter_mapbox_navigation: ^0.0.19

  #FLUTTER URI LAUNCHER
  url_launcher: ^6.0.2

  #FLUTTER SOUNDS
  audioplayers: ^0.17.4

  #FLUTTER ALARM MANAGER
#  android_alarm_manager: ^2.0.0

  #FLUTTER SIMPLE BAR RATING
  flutter_simple_rating_bar: 0.0.3

  #FLUTTER SUNRISE SUNSET
  sunrise_sunset: ^1.0.4

  #FLUTTER ICON LAUNCHER
  flutter_launcher_icons: ^0.8.1

  #FLUTTER ANIMATED SPLASH SCREEN
  animated_splash_screen: ^1.0.1+2

  #FLUTTER ANIMATE DO
  animate_do: ^1.7.5

  #FLUTTER COUNTRY PICKER
  country_code_picker: ^1.7.0

  #FLUTTER DELAYED ANIMATION
  delayed_display: ^1.1.0

  #FLUTTER CAROUSEL SLIDER
  carousel_slider: ^3.0.0

  #FLUTTER CACHED NETWORK IMAGE
  cached_network_image: ^2.5.0

  #FLUTTER SETTINGS UI
  settings_ui: ^0.6.0

  #FLUTTER VECTOR ICONS
  flutter_vector_icons: ^0.3.0

  #FLUTTER EXTENDED NAVBAR SCAFFOLD
  extended_navbar_scaffold:

  #FLUTTER CUSTOM SWITCH
  custom_switch: ^0.0.1

  #FLUTTER WAKELOCK
  wakelock: ^0.5.2

  #FLUTTER HTTP
  http: ^0.12.2

  #FLUTTER LOCALIZATIONS
  flutter_localizations:
    sdk: flutter

  #FLUTTER MULTIPLE IMAGE PICKER
  multi_image_picker: ^4.7.14

  #FLUTTER LOCAL NOTIFICATIONS
  flutter_local_notifications: ^4.0.1+1

  #FLUTTER GOOGLE PLACES
  flutter_google_places: ^0.2.6

  #FLUTTER DROPDOWN SEARCH
  dropdown_search: ^0.4.8

  #FLUTTER FIREBASE MESSAGING
  firebase_messaging: ^7.0.3

  #FLUTTER OVERLAY SUPPORT
  overlay_support: ^1.0.5

  #FLUTTER ANDROID INTENT
  android_intent: ^0.3.7+7

  #FLUTTER ROUNDED BUTTON
  rounded_loading_button: ^1.0.18

  #FLUTTER ZOOM MENU DRAWER
  flutter_zoom_drawer: ^1.0.4+1

  #FLUTTER FLOATING ACTION BUTTON CIRCULAR MENU
  fab_circular_menu: ^1.0.1

  #FLUTTER MENU
  floating_action_bubble: ^1.1.2

  #FLUTTER CHAT BUBBLES
  flutter_chat_bubble: ^1.0.2

  #FLUTTER PIN CODE FIELDS
  pin_code_fields: ^6.1.0

  #FLUTTER PIP
  flutter_android_pip: ^0.0.2

#  #FLUTTER SOME BS PIP
#  flutter_ajanuw_android_pip: ^0.1.2

  #FLUTTER SLIDE COUNTDOWN CLOCK
  slide_countdown_clock: ^1.0.3

  #FLUTTER MAP TOOLKIT
  maps_toolkit: ^1.1.0+2

  #FLUTTER TEST SOCKET IO
  socket_io_client: ^0.9.12

  #FLUTTER ALI SOCKING HAIRY DICK
  flutter_socket_io: ^0.6.0

  #FLUTTER KEYBOARD ATTACHABLE
  keyboard_attachable: ^2.0.0

  #FLUTTER KEYBOARD VISIBILITY
  #flutter_keyboard_visibility: ^4.0.4

  #FLUTTER SIMPLE DI
  flutter_simple_dependency_injection: ^1.0.4

  #FLUTTER AFTER LAYOUT
  after_layout: ^1.1.0


  #FLUTTER TOGGLE SWITCH
  flutter_switch: ^0.3.1

  #FLUTTER PERCENT INDICATOR
  percent_indicator: ^3.0.1



#  dependency_overrides:
#  intl: ^0.16.1
#  path: 1.7.0


#  #FLUTTER VOXIMPLANT
#  flutter_voximplant: 2.5.0
#
#  #FLUTTER CALL KIT VOXIMPLANT
#  flutter_callkit_voximplant: 1.1.0+3
#
#  #FLUTTER VOIP PUSH NOTIFICATION
#  flutter_voip_push_notification: 0.0.3




flutter_icons:
  image_path_android: "assets/captain_logo.png"
  image_path_ios: "assets/captain_logo.png"
  android: true # can specify file name here e.g. "ic_launcher"
  ios: true

dev_dependencies:
  flutter_test:
    sdk: flutter

dependency_overrides:
  intl: ^0.17.0
  location_platform_interface: 1.1.0
  plugin_platform_interface: ^1.0.2

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
   - assets/main_icon.png
   - assets/banned_image.jpg
   - assets/ic_approve_waiting.json
   - assets/loading_anime.json
   - assets/credit_card_animation.json
   - assets/blue_red_heart.json
   - assets/app_new_logo.png
   - assets/ic_car.png
   - assets/map_style.txt
   - assets/ic_user_marker.png
   - assets/captain_logo.png
   - assets/otp_vector_image.jpg
   - assets/new_captain_logo.png
   - assets/new_trip_ringtone.mp3
   - assets/splash_logo.png
   - lib/lang/en.json
   - lib/lang/ar.json
   - assets/new_order.mp3


  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

build.gradle(App):

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 = '28'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '2.8'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
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 29

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }
    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 "app_id"
        minSdkVersion 23
        multiDexEnabled true
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    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 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-messaging:21.0.1'
}

build.gradle(模块):

     buildscript {
      ext.kotlin_version = '1.4.32'
      repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.4'

    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

推荐答案

我遇到了此问题,并按照以下步骤解决了它。

  1. 使用distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip

    更新文件(gradle-wrapper.properties)
  2. 在项目结构中将JDK更新为11

这篇关于FLUTH:无法在调试或发布中构建Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆