Android manifest tools:replace error


#1

Getting an error after adding the nativescript-pager plugin…The prefix “tools” for attribute “tools:replace” associated with an element type “meta-data” is not bound.

nativescript-pager has the following dependencies.

dependencies {
compile "com.android.support:support-v4:+"
compile ‘com.eftimoff:android-viewpager-transformers:1.0.1@aar’
}

I have added the following to the androidmanifest.xml to force the android support library.

package.json dependencies.

“dependencies”: {
"@angular/common": “4.0.0”,
"@angular/compiler": “4.0.0”,
"@angular/core": “4.0.0”,
"@angular/forms": “4.0.0”,
"@angular/http": “4.0.0”,
"@angular/platform-browser": “4.0.0”,
"@angular/platform-browser-dynamic": “4.0.0”,
"@angular/router": “4.0.0”,
“nativescript-angular”: “~1.5.0”,
“nativescript-pager”: “^3.0.5”,
“nativescript-telerik-ui”: “^1.6.2”,
“nativescript-theme-core”: “~1.0.2”,
“reflect-metadata”: “~0.1.8”,
“rxjs”: “~5.2.0”,
“tns-core-modules”: “^2.5.2”,
“zone.js”: “~0.8.5”
},
“devDependencies”: {
“babel-traverse”: “6.4.5”,
“babel-types”: “6.4.5”,
“babylon”: “6.4.5”,
“lazy”: “1.0.11”,
“nativescript-dev-android-snapshot”: “^0..”,
“nativescript-dev-typescript”: “^0.3.5”,
“typescript”: “~2.1.0”
}


#2

It would help if you posted all of your AndroidManifest.


#3
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="PACKAGE"
android:versionCode="1"
android:versionName="1.0"
xmlns:tools=“http://schemas.android.com/apk/res-auto

>

<supports-screens
	android:smallScreens="true"
	android:normalScreens="true"
	android:largeScreens="true"
	android:xlargeScreens="true"/>

<uses-sdk
	android:minSdkVersion="17"
	android:targetSdkVersion="__APILEVEL__"/>

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

<application
	android:name="com.tns.NativeScriptApplication"
	android:allowBackup="true"
	android:icon="@drawable/icon"
	android:label="@string/app_name"
	android:theme="@style/AppTheme"
	tools:replace="android:value"
	
	>

	<activity
		android:name="com.tns.NativeScriptActivity"
		android:label="@string/title_activity_kimera"
		android:configChanges="keyboardHidden|orientation|screenSize"
		android:theme="@style/LaunchScreenTheme">

		<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />

		<intent-filter>
			<action android:name="android.intent.action.MAIN" />
			<category android:name="android.intent.category.LAUNCHER" />
		</intent-filter>
	</activity>
	<activity android:name="com.tns.ErrorReportActivity"/>
</application>

#4

Pete,

Getting a different error today. my project name is fintns.

fintns\platforms\android\build\intermediates\manifests\full\F0F1F2\debug\AndroidManifest.xml:26: AAPT: No resource identifier found for attribute ‘replace’ in package ‘org.nativescript.fintns’

Appreciate your help. I have been trying to get the viewpager like functionality working in nativescript but haven’t been successful.

Raghu


#5

It looks like you are trying to set priority metadata for some values of your app. I’d ask myself if any of this is really necessary.

First thing I noticed is that the xml namespace used in the manifest points to a location different than what is suggested in the Android User Guide - https://developer.android.com/studio/build/manifest-merge.html#merge_rule_markers

Second - Why would you need a meta-data entry with android support version? The Gradle build system should know enough about it. And if you want to explicitly specify it, you could do that in app.gradle

Third - You have no android:value attribute in your application tag, what exactly is it that you are trying to replace here then? If you wan’t to remove a potential android:value attribute, you should use tools:remove="android:value" instead.


#6

Pete,

I started changing the manifest after i got the error message below.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0-alpha1) from [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38
is also present at [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31 value=(25.3.1).
Suggestion: add ‘tools:replace=“android:value”’ to element at AndroidManifest.xml:25:5-27:41 to override.

Now I have added the following to the app.gradle which has fixed the issue.

configurations.all {
resolutionStrategy.eachDependency { details ->
def requested = details.requested
if (requested.group == ‘com.android.support’) {
if (!requested.name.startsWith(“multidex”)) {
details.useVersion ‘25.3.1’
}
}
}
}

Thanks for the help.

Raghu