Я делаю флаттер -проект на Android Studio Meerkat. Я сталкиваюсь с следующей ошибкой: < /p>
Gradle build failed to produce an .apk file. It's likely that this file was generated under C:\projects\level_7_buzzer\build, but the tool couldn't find it.
< /code>
Я провел вручную APK .... он существует в: < /p>
C:\projects\level_7_buzzer\android\app\build\outputs\flutter-apk\app-release.apk
< /code>
Я также установил его на своем устройстве: < /p>
adb install C:\projects\level_7_buzzer\android\app\build\outputs\flutter-apk\app-release.apk
< /code>
Но я думаю, что Flutter ожидает .apk at: < /p>
\build\app\outputs\apk\release\app-release.apk
< /code>
im застрял на этом этапе.
my sdk: без SDK.
Language Level-24 Сборщика потока.
Я не установлен Java с Oracle или любого другого веб-сайта.
Но все же моя версия Java показывает: OpenJDK Version "21.0.6" 2025-211
и Lopa Locave IS: C. Files \ Android \ Android Studio \ Jbr \ bin \ java.exe
rest Я поделился деталями и скриншотами ниже.Android Studio Meerkat Feature Drop | 2024.3.2 Patch 1
Build #AI-243.26053.27.2432.13536105, built on May 22, 2025
Runtime version: 21.0.6+-13368085-b895.109 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 10.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
ide.experimental.ui=true
Non-Bundled Plugins:
Dart (243.26753.1)
io.flutter (86.0.1)
< /code>
pubspec.yaml
name: level_7_buzzer
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter 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 is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/arc ... nKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: ^3.6.0
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
firebase_core: ^3.14.0
cloud_firestore: ^5.6.9
audioplayers: ^6.5.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^5.0.0
# 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 packages.
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/beep.mp3
- assets/notification_1.mp3
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/to/asset-from-package
# 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/to/font-from-package
< /code>
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.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
< /code>
gradle.properties:
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
< /code>
android \build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '2.0.20' // or the latest stable version available
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:8.5.0" // Use the latest stable version of the Gradle plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // Kotlin Gradle plugin
classpath "com.google.gms:google-services:4.4.2" // Google services plugin, if needed
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
tasks.register("clean", Delete) {
delete rootProject.layout.buildDirectory
}
< /code>
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()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.5.0" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}
include ":app"
< /code>
local.properties:
sdk.dir=C:\\Android\\Sdk
flutter.sdk=C:\\src\\flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.versionCode=1
< /code>
appuild.gradle:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
}
android {
namespace = "com.example.level_7_buzzer"
compileSdk = 35
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
kotlinOptions {
jvmTarget = "21" // Use string for jvmTarget
}
defaultConfig {
applicationId = "com.example.level_7_buzzer"
minSdk = 23
targetSdk = 34 // Ensure this matches your project needs
versionCode = 1 // Update as necessary
versionName = "1.0" // Update as necessary
}
buildTypes {
release {
signingConfig = signingConfigs.debug // Consider using a release signing config for production
}
}
}
flutter {
source = "../.."
}
dependencies {
implementation platform("com.google.firebase:firebase-bom:33.10.0") // Use the latest BoM version
implementation "com.google.firebase:firebase-analytics" // Version not specified due to using BoM
implementation "com.google.firebase:firebase-auth" // Version not specified due to using BoM
implementation "com.google.firebase:firebase-firestore" // Version not specified due to using BoM
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // Ensure this uses the updated version variable
}
< /code>
Android Manifest: < /p>
< /code>
Основная активность.kt: < /p>
package com.example.level_7_buzzer
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity()
< /code>
больше информации с использованием cmd: < /p>
C:\Users\Dell Precision M4800>adb devices
List of devices attached
HMTCCMHM8HGE45WC device
C:\Users\Dell Precision M4800>adb -s HMTCCMHM8HGE45WC shell getprop ro.product.model
23028RNCAG
C:\Users\Dell Precision M4800>adb install C:\projects\level_7_buzzer\android\app\build\outputs\flutter-apk\app-release.apk
Performing Streamed Install
Success
C:\Users\Dell Precision M4800>java -version
openjdk version "21.0.6" 2025-01-21
OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
OpenJDK 64-Bit Server VM (build 21.0.6+-13368085-b895.109, mixed mode)
C:\Users\Dell Precision M4800>where java
C:\Program Files\Android\Android Studio\jbr\bin\java.exe
C:\Users\Dell Precision M4800>flutter doctor -v
[√] Flutter (Channel stable, 3.32.5, on Microsoft Windows [Version 10.0.18362.1256], locale en-US) [411ms]
• Flutter version 3.32.5 on channel stable at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• FLUTTER_GIT_URL = https://github.com/flutter/flutter.git
• Framework revision fcf2c11572 (4 days ago), 2025-06-24 11:44:07 -0700
• Engine revision dd93de6fb1
• Dart version 3.8.1
• DevTools version 2.45.1
[√] Windows Version (10 Pro 64-bit, 1903) [1,274ms]
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [3.9s]
• Android SDK at C:\Android\Sdk
• Platform android-35, build-tools 35.0.1
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
• All Android licenses accepted.
[√] Chrome - develop for the web [28ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop Windows apps [27ms]
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.3.2) [24ms]
• Android Studio at C:\Program Files\Android\Android Studio
• 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 21.0.6+-13368085-b895.109)
[√] Connected device (3 available) [229ms]
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.18362.1256]
• Chrome (web) • chrome • web-javascript • Google Chrome 137.0.7151.120
• Edge (web) • edge • web-javascript • Microsoft Edge 137.0.3296.93
[√] Network resources [594ms]
• All expected network resources are available.
! Doctor found issues in 1 category.
C:\Users\Dell Precision M4800>flutter analyze --suggestions
┌──────────────────────────────┐
│ General Info │
│ [X] App Name: name not found │
└──────────────────────────────┘
< /code>
скриншот Dart sdk
< /p>
scenshot of fluther sdk:
scenshot gradle
< /p>
sdks
< /p>
Структура проекта
Расхождение структуры проекта
ststatic.net/voio5lth.pg "/> ststatic.net/voio5lth.pg"/>
stestatic.net/voio5lth.pg " />
Подробнее здесь: https://stackoverflow.com/questions/796 ... e-was-gene
Gradle Build не удалось создать файл .apk. Вполне вероятно, что этот файл был сгенерирован в соответствии с C: \ <**> \ ⇐ Android
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение