Home > OS >  Playstore error: no AndroidManifest.xml found
Playstore error: no AndroidManifest.xml found

Time:01-12

I recently upgraded my cordova and android version. Now i can not upload the .apk to the play store.

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

  • macos 11.6.4
  • node v16.13.2
  • npm 8.1.2
  • cordova 11.0.0
  • Android platform 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.

In the final .apk there is /base/manifest/AndroidManifest.xml which mostly contains URLs and characters which vscode can not display.

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

CodePudding user response:

Since you generate a bundle, you should upload the bundle, instead of the .apk, to Google Play and turn on app signing. You should have a build.json file at the root of you cordova project, following this format :

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

CodePudding user response:

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. This file is an important part of the APK and contains information about the app's package name, version, permissions, and other settings.

It seems that the AndroidManifest.xml file is present in the correct location 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. 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.

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. Also, it's worth to check whether the firebase plugin is configured correctly

 cordova plugin remove cordova-android-support-gradle-release
cordova plugin add [email protected]

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

  • Related