简体   繁体   English

错误:属性“包”在<manifest>标记不是有效的 Android 包名称

[英]Error: attribute 'package' in <manifest> tag is not a valid Android package name

我正在尝试编写一个曾经构建过的android应用程序。现在,每次构建时,都会出现以下错误:

Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
C:\Users\Jay\AndroidStudioProjects\DndTools-App\app\build\intermediates\merged_manifests\debug\AndroidManifest.xml:2: AAPT: 
error: attribute 'package' in <manifest> tag is not a valid Android package name: 'dndtools'.

Change applicationId "dndtools" to applicationId "com.dndtools.android.dndtools" .applicationId "dndtools"更改为applicationId "com.dndtools.android.dndtools"

applicationId in your build.gradle file is what is used as the real package, that's why you can see it in the merged manfiest as well. applicationId在你的build.gradle文件是干什么用的真正的包,这就是为什么你可以看到它在合并manfiest为好。 Update it to match the one you have in your Android Manfiest and it should work fine.更新它以匹配您在 Android Manfiest 中的那个,它应该可以正常工作。

As for why it's an invalid package - it needs to have at least one dot in it to be installable on Android.至于为什么它是一个无效的包 - 它需要至少有一个点才能在 Android 上安装。

In my Case, I have updated the Android studio to version 3.5.3 , and while project setup, by mistake I have added applicationIdSuffix = kotlin_version , so this is what causing the problem.在我的案例中,我已将 Android studio更新版本 3.5.3 ,并且在项目设置时,我错误地添加了applicationIdSuffix = kotlin_version ,所以这就是导致问题的原因。

So simply removing this line helped me to fix this issue.因此,只需删除此行即可帮助我解决此问题。

in my case, i build app use default config就我而言,我构建应用程序使用默认配置

compileSdkVersion 30

defaultConfig {
    applicationId "com.webview.app"
    minSdkVersion 23
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    applicationIdSuffix kotlin_version
}

when i add productFlavors当我添加 productFlavors

  flavorDimensions "default"
  productFlavors {
    test01{
        dimension "default"
        applicationIdSuffix ".test"
        versionNameSuffix "-test00"
    }

    test01{
        dimension "default"
        applicationIdSuffix ".test"
        versionNameSuffix "-test01"
    }

    test01{
        dimension "default"
        applicationIdSuffix ".test"
        versionNameSuffix "-test02"
    }
}

then i'm runing my app, i got this message然后我正在运行我的应用程序,我收到了这条消息

tag is not a valid Android package name: 'com.webview.app.1.4.21.jb'

i think the problem shoud be number and point(.) can not be package name, so i delete code我认为问题应该是数字和点(。)不能是包名,所以我删除了代码

applicationIdSuffix kotlin_version

it's work for me, because kotlin_version value it's ext.kotlin_version = "1.4.21" , when my appid contain number and point(.) it cannot working.它对我有用,因为 kotlin_version 值是ext.kotlin_version = "1.4.21" ,当我的 appid 包含 number 和 point(.) 时,它无法工作。 in android the appid(pacakege name) should be like this 'come.domain.project' it is reverse domain name.在android中,appid(pacakege name)应该是这样的'come.domain.project',它是反向域名。

My problem was with uncorrect naming of the package id.我的问题是包 ID 的命名不正确。 I put something like com.example.3d .我放了类似com.example.3d东西。 You can't start with the number like 3d .你不能从像3d这样的数字开始。

A full Java-language-style package name for the Android app. Android 应用程序的完整 Java 语言样式的包名称。 The name may contain uppercase or lowercase letters ('A' through 'Z'), numbers, and underscores ('_').名称可以包含大写或小写字母(“A”到“Z”)、数字和下划线(“_”)。 However, individual package name parts may only start with letters但是,个别包名部分只能以字母开头

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AAPT 错误:属性“包”在<manifest>标签不是有效的 Android package 名称</manifest> - AAPT Error: attribute 'package' in <manifest> tag is not a valid Android package name 标签 <manifest> 属性包的字符无效&#39;&#39;Android清单 - Tag <manifest> attribute package has invalid character ' ' Android Manifest APT:错误:标记中的属性“package”不是有效的 Java 包名称:“com.mypackage.name_.app” - APT: error: attribute 'package' in tag is not a valid Java package name: 'com.mypackage.name_.app' Android清单包名称 - Android manifest package name 包名称中的 Android Studio 清单合并错误 - Android Studio Manifest merger error in package name 错误:(2)标签 <manifest> 属性包中包含无效字符“?” - Error:(2) Tag <manifest> attribute package has invalid character '?' Android清单错误-软件包&#39;android&#39;中找不到属性&#39;documentLaunchMode&#39;的资源标识符 - Android Manifest error - No resource identifier found for attribute 'documentLaunchMode' in package 'android' 标签 <manifest> 属性包中包含无效字符&#39;; “ - Tag <manifest> attribute package has invalid character '; ' 清单标记的属性包和R类问题 - Attribute package of manifest tag and R class problem Android软件包名称不是有效的软件包名称 - Android Package Name is not a valid Package name
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM