【问题标题】:Build failed after installing and configuring react-native-fbsdk安装和配置 react-native-fbsdk 后构建失败
【发布时间】:2019-10-30 17:08:55
【问题描述】:

在完成github pagefacebook getting started pagequick start for android page 中提供的所有必要配置步骤之后,我已经初始化了一个新的 android 项目并在我的项目上安装了 react-native-fbsdk 我无法运行我的项目,即使不编写任何代码。 (我尝试过修改前两个 build.gradle 步骤和不修改)

这是我收到的错误消息:

> Task :react-native-fbsdk:generateDebugRFile FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-fbsdk:generateDebugRFile'.
> Illegal char <?> at index 7: ..\..\l?brary_man?fest\debug\AndroidManifest.xml

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with
Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:comm
and_line_warnings

BU?LD FAILED in 3s
10 actionable tasks: 2 executed, 8 up-to-date
error Could not install the app on the device, read the error above for details.

Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag
for more details.

这是我迄今为止尝试过的:

cd android
gradlew build --warning-mode all

给我一​​个类似于上一条的错误信息,唯一的区别是有这一行

Changing the value for a property with a final value has been deprecated. This will fail with an error in Gradle 6.0.

我无法找到研究此问题的解决方案。

然后我尝试查看 D:\kitapapp\node_modules\react-native-fbsdk\android\build\intermediates\lıbrary_manıfest\debug 中的 android 清单,但我也无能为力。我突然想到,它可能与名称中包含“ı”而不是“i”的“lıbrary_manıfest”文件夹有关,但在与“lıbrary_manıfest”相同的文件夹中还有其他文件也有“ı”他们的名字。我认为无论如何我都无法修改 react-native-fbsdk,因为我应该使用它们? (但也许我错了?)

我还尝试在我的 package.json 中降级 react-native-fbsdk 并再次删除 node_modules 和 npm 安装,给了我相同的错误消息。

编辑:AndroidManifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.kitapapp">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <meta-data android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id"/>
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity 
android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

strings.xml(我在这里放了“id”而不是这篇文章的真实 id。实际上那里有我的实​​际应用程序 id)

<resources>
    <string name="app_name">kitapapp</string>
    <string name="facebook_app_id">id</string>
</resources>

【问题讨论】:

  • 请上传您的 AndroidManifest.xml 数据
  • @GáüřãvJõşhï 我现在添加了它
  • @GáüřãvJõşhï 是否应该将我的实际应用程序 ID 放在清单中?我的想法是,因为已经有像'android:label'这样的东西有值“@string/app_name”而不是实际的应用程序名称,所以我不应该输入我的实际ID。我链接的安装/配置指南都没有特别提到这样的事情?
  • 转到/android/app/src/main/res/values/strings.xml并上传xml中的数据
  • @GáüřãvJõşhï 好的,我已经做到了,但我没有在帖子中输入我的实际 ID。

标签: visual-studio react-native build react-native-fbsdk illegal-characters


【解决方案1】:

错误似乎来自:-
Illegal charat index 7: ..\..\l?brary_man?fest\debug\AndroidManifest.xml

即:- l?brary_man?fest ?在项目文件夹名称中标记。

我遵循了您在我的一个使用 react-native-fbsdk 的项目中编写的路径

路径:- \node_modules\react-native-fbsdk\android\build\intermediates\lıbrary_manıfest\debug

但在我的项目中,文件夹名称中的任何“i”都没有错误。


我只能建议您删除 node_modules 文件夹和 npm install 模块。
顺便说一句,我正在使用“react-native-fbsdk”:“^0.8.0”版本。
希望对你有帮助。

如果它不起作用,我认为问题出在您的 Android Studio 上。 它没有正确构建项目。 尝试更新它。

更新:- 似乎是 Visual Studio 中出现的问题。 请检查链接:- https://stackoverflow.com/a/9258530/11129555

【讨论】:

  • 原来问题确实与 library_manifest 问题有关,我的计算机语言设置为土耳其语,而土耳其语中有两个不同的字母“I”。 “I”的小写对应物是“ı”,“i”的大写对应物是“İ”。将计算机的显示语言更改为英语并重新启动计算机后,我删除了项目中安装的 node_modules 和 npm,现在它可以工作了。
  • 我假设在安装 react-native-fbsdk 文件时,文件名会从大写转换为小写,这是问题的根源。可以肯定的是,同一文件路径中的“library_manifest”现在在工作版本中有“i”。
  • npm 说:- 您不能再创建名称中带有大写字母的新包,但名称中带有大写字母的包仍在注册表中并且仍在使用中。你说的是对的……给答案点赞
猜你喜欢
  • 2021-02-04
  • 1970-01-01
  • 1970-01-01
  • 2021-01-09
  • 2023-02-22
  • 1970-01-01
  • 2018-10-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多