简体   繁体   English

Playstore 错误:找不到 AndroidManifest.xml

[英]Playstore error: no AndroidManifest.xml found

I recently upgraded my cordova and android version.我最近升级了我的 cordova 和 android 版本。 Now i can not upload the.apk to the play store.现在我无法将.apk 上传到Play 商店。

Error message: Failed to run aapt dump badging: ERROR: dump failed because no AndroidManifest.xml found错误信息: Failed to run aapt dump badging: ERROR: dump failed because no AndroidManifest.xml found

  • macos 11.6.4 macOS 11.6.4
  • node v16.13.2节点 v16.13.2
  • npm 8.1.2 npm 8.1.2
  • cordova 11.0.0 cordova 11.0.0
  • Android platform 11.0.0 Android 平台 11.0.0

I have found a AndroidManifest.xml that is in platforms/android/app/src/main/AndroidManifest.xml and tried to copy it to different places, which did not help.我在platforms/android/app/src/main/AndroidManifest.xml中找到了一个AndroidManifest.xml并试图将它复制到不同的地方,但没有帮助。

In the final.apk there is /base/manifest/AndroidManifest.xml which mostly contains URLs and characters which vscode can not display.在 final.apk 中有/base/manifest/AndroidManifest.xml ,其中主要包含 vscode 无法显示的 URL 和字符。

my build script:我的构建脚本:

#!/bin/bash

# Android

## vars
buildfolder=~/Repos/app-cordova/platforms/android/app/build/outputs/bundle/release/
buildname=app-release.aab

rm $buildfolder/*;
cordova build android --release;
cd $buildfolder;
~/Library/Android/sdk/build-tools/30.0.3/zipalign -v -p 4 $buildname unsigned-aligned.apk;
~/Library/Android/sdk/build-tools/30.0.3/apksigner sign --ks ~/.private/app-release-key.jks --min-sdk-version 21 --out app.apk unsigned-aligned.apk;
open .;

build log:构建日志:

11.0.0
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: No custom version found in config.xml - using plugin default
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: No custom version found in config.xml - using plugin default
cordova-plugin-firebasex: Preparing Firebase on Android
Checking Java JDK and Android SDK versions
ANDROID_HOME=/Users/username/Library/Android/sdk (recommended setting)
ANDROID_SDK_ROOT=/Users/username/Library/Android/sdk (DEPRECATED)
Android build number incremented to "1213"
Saved in config.xml
Using Android SDK: /Users/username/Library/Android/sdk
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 27.+
+-----------------------------------------------------------------
strippedNativeLibsDir is deprecated and no longer used. Please remove it from your build configuration.

> Task :app:preBuild UP-TO-DATE
[....]
> Task :app:bundleRelease

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 8s
62 actionable tasks: 17 executed, 45 up-to-date
Built the following bundle(s): 
    /Users/username/Repos/projectname/platforms/android/app/build/outputs/bundle/release/app-release.aab
Verifying alignment of unsigned-aligned.apk (4)...
      54 BundleConfig.pb (OK - compressed)
     440 BUNDLE-METADATA/com.android.tools.build.libraries/dependencies.pb (OK - compressed)
    8870 BUNDLE-METADATA/com.android.tools.build.gradle/app-metadata.properties (OK - compressed)
    9002 base/assets/www/cordova.js (OK - compressed)
   26034 base/assets/www/cordova_plugins.js (OK - compressed)
   27165 base/assets/www/css/app.css (OK - compressed)
[....]
12019277 base/manifest/AndroidManifest.xml (OK - compressed)
12024496 base/assets.pb (OK - compressed)
12024922 base/native.pb (OK - compressed)
12025058 base/resources.pb (OK - compressed)
Verification succesful
Keystore password for signer #1: 
^c

Since you generate a bundle, you should upload the bundle, instead of the.apk, to Google Play and turn on app signing.由于您生成了捆绑包,因此您应该将捆绑包而不是 .apk 上传到 Google Play 并启用应用程序签名。 You should have a build.json file at the root of you cordova project, following this format:您应该在 cordova 项目的根目录下有一个build.json文件,格式如下:

{
    "android": {
        "debug": {
            "keystore": "mykey.keystore",
            "storePassword": "something!",
            "alias": "something",
            "password" : "something!",
            "keystoreType": ""
        },
        "release": {
            "keystore": "mykey.keystore",
            "storePassword": "something!",
            "alias": "something",
            "password" : "something!",
            "keystoreType": ""
        }
    }
}

The error message Failed to run aapt dump badging: ERROR: dump failed because no AndroidManifest.xml found is indicating that the aapt tool (Android Asset Packaging Tool) that is used during the APK build process is unable to find the AndroidManifest.xml file.报错Failed to run aapt dump badging: ERROR: dump failed because no AndroidManifest.xml found 表示APK构建过程中使用的aapt工具(Android Asset Packaging Tool)找不到AndroidManifest.xml文件。 This file is an important part of the APK and contains information about the app's package name, version, permissions, and other settings.此文件是 APK 的重要组成部分,包含有关应用的 package 名称、版本、权限和其他设置的信息。

It seems that the AndroidManifest.xml file is present in the correct location platforms/android/app/src/main/AndroidManifest.xml. AndroidManifest.xml 文件似乎位于正确的位置 platforms/android/app/src/main/AndroidManifest.xml。 However, It could be possible that the file is not being copied over to the correct location during the build process.但是,在构建过程中可能没有将文件复制到正确的位置。

Based on the build log, you are using cordova-android-support-gradle-release plugin which could be the cause of the problem.根据构建日志,您正在使用 cordova-android-support-gradle-release 插件,这可能是问题的原因。 The plugin uses the Gradle build system to build the Android app and it's possible that the plugin is not configured correctly to include the AndroidManifest.xml file.该插件使用 Gradle 构建系统来构建 Android 应用程序,并且该插件可能未正确配置以包含 AndroidManifest.xml 文件。

One solution that you could try is to update the cordova-android-support-gradle-release plugin to its latest version (currently is 4.0.0) and make sure that the plugin is correctly configured in your config.xml file.您可以尝试的一种解决方案是将 cordova-android-support-gradle-release 插件更新到其最新版本(当前为 4.0.0)并确保该插件在您的 config.xml 文件中正确配置。 Also, it's worth to check whether the firebase plugin is configured correctly此外,值得检查 firebase 插件是否配置正确

 cordova plugin remove cordova-android-support-gradle-release
cordova plugin add cordova-android-support-gradle-release@4.0.0

Another option is to use cordova-android instead of cordova-android-support-gradle-release in your cordova platform, this is the default platform for Cordova, it doesn't use gradle and should resolve the problem.另一种选择是在 cordova 平台中使用 cordova-android 而不是 cordova-android-support-gradle-release,这是 Cordova 的默认平台,它不使用 gradle,应该可以解决问题。

cordova platform remove android
cordova platform add android

Lastly, it's worth to check your build.gradle files in the platforms/android folder for any configuration that may cause this problem or even try to remove and add android platform again, this should regenerate all the necessary files.最后,值得检查 platforms/android 文件夹中的 build.gradle 文件是否有任何可能导致此问题的配置,甚至尝试再次删除和添加 android 平台,这应该会重新生成所有必要的文件。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM