'Failed to query the value of property 'packageName'

I am running React-Native 0.63.4 and encountering the following error:

Execution failed for task ':app:generateDebugBuildConfig'.
> Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'buildConfigPackageName'.
   > Failed to query the value of property 'packageName'.
      > java.lang.NumberFormatException: For input string: "1.0.0"

This occurs when running npm run android, shortly after Gradle is done configuring the app and tries to execute it.

This error occurs both when I run the command from the root folder of the project as well as from the /android/ subfolder.

I did a gradlew clean but it is not helping.

Edit:

If I go in my /android/ folder and run gradlew android, the build will complete without error.

It is only when I run npm run android that this error shows up.



Solution 1:[1]

I finally figured it out.

on the file: android/app/src/main/AndroidManifest.xml

The content began by:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.MyBusiness.MyApp"
          android:versionCode="1.0.0"
          android:versionName="1.0.0">

The versionCode has to be an integer: Only digits allowed. Apparently it does not matter what it is as it will increment whatever number we put.

Changing this to a number solved my problem:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.MyBusiness.MyApp"
          android:versionCode="1000"
          android:versionName="1.0.0">

Solution 2:[2]

Here's another solution:

  • It's possible the xmls:tools is missing from android/app/src/main/AndroidManifest.xml folder. So you'll need to add that back.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.<buildname>">
  • This should be the first line at the top of your Manifest.xml.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 FMaz008
Solution 2