Ошибка Flutter APK: установка пространства имен через атрибут пакета в исходном файле AndroidManifest.xml невозможна.Android

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Ошибка Flutter APK: установка пространства имен через атрибут пакета в исходном файле AndroidManifest.xml невозможна.

Сообщение Anonymous »

Я пытаюсь создать APK для своего проекта Flutter, но получаю массу ошибок Gradle. На подобные вопросы здесь не было никаких подходящих ответов. Вот вывод команды сборки:
One or more plugins require a higher Android NDK version.
Fix this issue by adding the following to /Users/jacobmiller/Local Documents/Development/app/android/app/build.gradle:
android {
ndkVersion "25.1.8937393"
...
}

Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 3056 bytes (99.8% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Incorrect package="io.flutter.plugins.firebase.core" found in source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/firebase_core-2.25.4/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="io.flutter.plugins.firebase.core" from the source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/firebase_core-2.25.4/android/src/main/AndroidManifest.xml.
Incorrect package="io.flutter.plugins.firebase.messaging" found in source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.15/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="io.flutter.plugins.firebase.messaging" from the source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.15/android/src/main/AndroidManifest.xml.
Incorrect package="com.hui.bluetooth_enable" found in source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/bluetooth_enable_fork-0.1.6/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.hui.bluetooth_enable" from the source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/bluetooth_enable_fork-0.1.6/android/src/main/AndroidManifest.xml.
Incorrect package="com.mr.flutter.plugin.filepicker" found in source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/file_picker-6.1.1/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.mr.flutter.plugin.filepicker" from the source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/file_picker-6.1.1/android/src/main/AndroidManifest.xml.

FAILURE: Build completed with 4 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':bluetooth_enable_fork:processReleaseManifest'.
> A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
> Incorrect package="com.hui.bluetooth_enable" found in source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/bluetooth_enable_fork-0.1.6/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.hui.bluetooth_enable" from the source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/bluetooth_enable_fork-0.1.6/android/src/main/AndroidManifest.xml.

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':firebase_messaging:processReleaseManifest'.
> A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
> Incorrect package="io.flutter.plugins.firebase.messaging" found in source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.15/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="io.flutter.plugins.firebase.messaging" from the source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.15/android/src/main/AndroidManifest.xml.

* 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.
==============================================================================

3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':file_picker:processReleaseManifest'.
> A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
> Incorrect package="com.mr.flutter.plugin.filepicker" found in source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/file_picker-6.1.1/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.mr.flutter.plugin.filepicker" from the source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/file_picker-6.1.1/android/src/main/AndroidManifest.xml.

* 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.
==============================================================================

4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':firebase_core:processReleaseManifest'.
> A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
> Incorrect package="io.flutter.plugins.firebase.core" found in source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/firebase_core-2.25.4/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="io.flutter.plugins.firebase.core" from the source AndroidManifest.xml: /Users/jacobmiller/.pub-cache/hosted/pub.dev/firebase_core-2.25.4/android/src/main/AndroidManifest.xml.

Вот мои настройки.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
}
settings.ext.flutterSdkPath = flutterSdkPath()

includeBuild("${settings.ext.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.2.0' apply false
id "org.jetbrains.kotlin.android" version "1.9.22" apply false
}

include ":app"

build.gradle:
allprojects {
repositories {
google()
mavenCentral()
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {

afterEvaluate {
android {
namespace 'add your namespace here'
}
}
project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
}

app/build.gradle:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

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

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
namespace "com.jacobmiller.app"
compileSdkVersion flutter.compileSdkVersion
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/bu ... on-id.html).
applicationId "com.jacobmiller.app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/and ... figuration.
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

signingConfigs {
release {
if (System.getenv("ANDROID_KEYSTORE_PATH")) {
storeFile file(System.getenv("ANDROID_KEYSTORE_PATH"))
keyAlias System.getenv("ANDROID_KEYSTORE_ALIAS")
keyPassword System.getenv("ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD")
storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
} else if (keystoreProperties != null) {
// Make sure to define these properties in your local.properties file or set them as environment variables
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}

}

buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

}

}

flutter {
source '../..'
}

dependencies {}



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

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

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

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

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

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

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