安装和配置react-native-fbsdk后构建失败

时间:2019-06-17 06:21:57

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

在完成github pagefacebook getting started page和{{3}中提供的所有必要配置步骤之后,我已经初始化了一个新的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”相同的文件夹中还有其他文件也包含“ı”他们的名字。我不认为我可以使用modyfing 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>

1 个答案:

答案 0 :(得分:0)

错误似乎来自:

  

索引7处的非法字符var aLookup = a.ToLookup(x => x); var bLookup = b.ToLookup(x => x); var filtered = aLookup .SelectMany(aItem => aItem.Take(aItem.Count() - bLookup[aItem.Key].Count())); :.... \ l?brary_man?fest \ debug \ AndroidManifest.xml

i.e。:-l <?> brary_man ?在项目文件夹名称中标记。

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

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

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

image

我只能建议您删除node_modules文件夹并?个模块。顺便说一句,我正在使用“ react-native-fbsdk”:“ ^ 0.8.0”版本。

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

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