Search code examples
visual-studioreact-nativebuildreact-native-fbsdkillegal-characters

Build failed after installing and configuring react-native-fbsdk


I have initialized a new android project and I installed react-native-fbsdk on my project, after doing all the necessary configuration steps provided in the github page, facebook getting started page, and the quick start for android page I am not able to run my project, even without writing any code. (I've tried with and without modifying the first two build.gradle steps)

Here's the error message I'm getting:

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

Heres what I have tried so far:

cd android
gradlew build --warning-mode all

Gives me an error message similar to the previous one, only difference is there is this line

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

I couldn't reach a solution researching this.

Then I have tried looking into the android manifest in D:\kitapapp\node_modules\react-native-fbsdk\android\build\intermediates\lıbrary_manıfest\debug , but I couldn't do anything with it either. It occurred to me that maybe it is related to the "lıbrary_manıfest" folder having "ı"s in it's name instead of "i"s but there were other files in the same folder as "lıbrary_manıfest" that also had "ı"s in their name. I don't think I can get pretty far modyfing react-native-fbsdk anyway since I'm supposed to use them? (but maybe I am wrong?)

I have also tried downgrading react-native-fbsdk in my package.json and deleting node_modules and npm installing again, gave me the same error message.

Edit: 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 (I've put "id" here instead of the real id for this post. In reality there is my actual app id there)

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

Solution

  • The error seems to come from :-
    Illegal charat index 7: ..\..\l?brary_man?fest\debug\AndroidManifest.xml

    i.e.:- l?brary_man?fest the ? mark in the project folder names.

    I followed the path you had written in one of my projects that was using react-native-fbsdk

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

    but in my project there was no mistake in any of the "i"s in the folder names.

    image


    I can only suggest you to delete the node_modules folder and npm install the modules.
    BTW i am using "react-native-fbsdk": "^0.8.0" version.
    Hope it will help you.

    If it does not work, i think the problem is with your Android Studio. It is not building the project properly. Try updating it.

    Update:- It seems that it is a problem that arises in Visual Studio. Please check the link:- https://stackoverflow.com/a/9258530/11129555