无法查询属性“packageName"的值 [英] Failed to query the value of property 'packageName'

查看:113
本文介绍了无法查询属性“packageName"的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 React-Native 0.63.4 并遇到以下错误:

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"

在运行 npm run android 时会发生这种情况,在 Gradle 完成配置应用程序并尝试执行它后不久.

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

当我从项目的根文件夹以及/android/子文件夹运行命令时,都会发生此错误.

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

我做了一个 gradlew clean 但它没有帮助.

I did a gradlew clean but it is not helping.

如果我进入我的/android/文件夹并运行 gradlew android,构建将完成而不会出错.

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

只有当我运行 npm run android 时才会出现这个错误.

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

推荐答案

我终于想通了.

在文件上:android/app/src/main/AndroidManifest.xml

内容开始于:

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

versionCode 必须是整数:只允许使用数字.显然它是什么并不重要,因为它会增加我们输入的任何数字.

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

这篇关于无法查询属性“packageName"的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆