简体   繁体   中英

Android resource linking failed in the build

I get some errors when I to build my android (ionic + capacitor) project. Im using android studio for the build process. The generated android manifest.xml file is giving me some android resource linking errors. To be Clear, its a generated file.

Its located at: android/capacitor-cordova-android-plugins/build/intermediates/library_manifest/debug/AndroidManifest.xml

An example of the following errors:

URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs)
Attribute android:configChanges is not allowed here
Attribute android:versionCode is not allowed here
Attribute android:enabled is not allowed here

<uses-sdk
    android:minSdkVersion="21"
    android:targetSdkVersion="29" />

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

<application>
    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/fb_app_id" />
    <meta-data
        android:name="com.facebook.sdk.ApplicationName"
        android:value="@string/fb_app_name" />

    <activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/fb_app_name" />

    <receiver
        android:name="nl.xservices.plugins.ShareChooserPendingIntent"
        android:enabled="true" >
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
        </intent-filter>
    </receiver>

    <provider
        android:name="nl.xservices.plugins.FileProvider"
        android:authorities="${applicationId}.sharing.provider"
        android:exported="false"
        android:grantUriPermissions="true" >
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/sharing_paths" />
    </provider>
</application>

I did try to update all the dependencies and to clean and rebuild the project. Where or how should this issue be solved?

I had this same issue, what worked for me was adding the missing strings for the facebook plugin. In android studio go to capacitor-android/res/values/strings.xml and add this variables:

<string name="fb_app_id">[YOUR_APP_ID]</string>
<string name="fb_app_name">[YOUR_APP_NAME]</string>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM