Gradle Build не удалось создать файл AN.APK. Вполне вероятно, что этот файл был сгенерирован в рамках D: \ Projects \ naAndroid

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Gradle Build не удалось создать файл AN.APK. Вполне вероятно, что этот файл был сгенерирован в рамках D: \ Projects \ na

Сообщение Anonymous »

Я использую Android Studio Ladybug с последним трепетом и SDK. Моя версия Flutter - 3,32 (конюшня канала), а моя версия DART - 3.8.1.
Недавно я клонировал проект от GitHub, который когда -то отправил в GitHub.
он работал нормально перед загрузкой в ​​GitHub, но теперь, когда я клонировал его, это получает ошибки. (Как и прежде, толкание, возможно, версии Flutter и DART были разными, также я думаю, что версия Android Studio, возможно, была одинаковой или другой, что я не помню.) < /p>
Самая первая ошибка, которую я получил, касается имени пользователя. Мое предыдущее имя пользователя (C:\users\username\studioprojects), откуда я загружен в GitHub, был без пробелов, но когда я клонирую его к другому ноутбуку, чье имя пользователя с пробелами между ними (между ними (между ними (между ними (между ними (между нимиC:\users\user name\studioprojects< /code>), это дает мне ошибку.
Итак, что я сделал, это клонировать проект в папку (D:\projects\level_7_buzzer) с именем папки без пробелов .. (D:\projects\). Так вот как была исправлена ​​ошибка.
Я также получил ошибку Google-service.json не найдена, я не знаю, возможно, она была удалена во время загрузки или нет, я действительно не понял. Ошибка. < /p>
Теперь, после устранения неполадок приведенных выше ошибок, я застрял в < /p>

Ошибка: сборка Gradle Не удалось создать файл .apk. Вполне вероятно, что
Этот файл был сгенерирован в D: \ Projects \ Level_7_buzzer \ Build, но
инструмент не смог его найти. D: \ Projects \ Level_7_Buzzer \ Android \ App \ Build < /code> < /p>
Что я думаю, чтобы обновить Android Studio до последней версии. и получил ошибку: < /li>
< /ul>

ps d: \ projects \ level_7_buzzer> Flutter Install Installing
App-release.apk to 23028rncag ...
"build\ applimestputs\flutter-apkkudeas-release. Неудача

Мой текущий клон проекта находится в следующей папке: D: \ Projects \ Level_7_buzzer .
Мой трепетание в C: \ abc \ flutter
sdk.dir=C:\\Users\\user name\\AppData\\Local\\Android\\sdk

my sdk.dir Path имеет имя пользователя с пробелами между.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.3.1" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}

include ":app"
< /code>

gradle-wraper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
< /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.3.1" // 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
}

App/build.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_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17" // 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>
функциональный




















< /code>
функциональныйpackage com.example.level_7_buzzer

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity()
< /code>

local.properties:

sdk.dir=C:\\Users\\x y z\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\abc\\flutter
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1

my local.properties имеет место между именем пользователя (имя пользователя), тогда как у моего проекта есть каталог без места между.
sdk.dir=C:\\users\\x y z\\appdata\\.... и т. Д., И мой Flutter SDK находится в C: , а мой проект находится в D: \ Projects \ Level_7_Buzzer .

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.7.0
cloud_firestore: ^5.4.5
audioplayers: ^6.1.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


Подробнее здесь: https://stackoverflow.com/questions/796 ... -was-gener
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Android»