I am trying to use hCaptcha library on my project. However, it seems that hCaptcha library comes with a usesCleartextTraffic tag defined on the Manifest which is already defined by another library. When I add hCaptcha and try to run the project I get the following error:
Attribute application#usesCleartextTraffic value=(true) from [com.theoremreach:theoremreach:3.5.1] AndroidManifest.xml:15:9-44
is also present at [com.github.hcaptcha:hcaptcha-android-sdk:3.3.6] AndroidManifest.xml:11:9-45 value=(false).
Suggestion: add 'tools:replace="android:usesCleartextTraffic"' to <application> element at AndroidManifest.xml:17:5-132:19 to override.
Great, there is a suggestion. Now by adding the following to my application tag on the Manifest, I can avoid any errors and run my application:
tools:replace="android:usesCleartextTraffic"
android:usesCleartextTraffic="true"
My question is, replacing this value with true will not influenciate the hCaptcha Manifest false value for usesCleartextTraffic?
What would be the correct way to solve this error, without affecting each library security?
Related
Problem: I get the following error when trying to run the Xamarin.Android application:
"he application does not have the 'android:debuggable' attribute set in the AndroidManifest.xml"
Even though I do have it set in the manifest:
<application android:label="SomeAPP" android:debuggable="false" android:theme="#style/SOMETheme" android:icon="#drawable/some_icon_180px" android:requestLegacyExternalStorage="true">
I don't want to set it to true, because I am about to upload to the Google Play Store.
I also looked for debuggable in the entire project. It does not exist in any other files in this project.
Why is it still stating that?
At first, the 'android:debuggable' attribute doesn't need the developer to set, it will be set as false when you run it in the release mode and as true when you run it in the debug mode.
And I have checked a number of my projects' AndroidManifest.xml, all of them don't have this attribute in the file.
You can try to create a new project to test this or update the packages you added into your project. The third-party package may cause this error.
After integrating RN into an existing Android project, I get the following error:
Error: Package name not found in /home/.../AndroidManifest.xml at Object.projectConfig (/home/.../rn_integrated_app/node_modules/#react-native-community/cli-platform-android/build/config/index.js:74:11) at Object.get project [as project]
As I understand the problem is that there is no package attribute in the relevant AndroidManifest.xml file. Since my project has many flavors, the package attribute is added dynamically, while compiling, through app/build.gradle:
def pkgDataEntry = getRightValue(packagesData, variantMap)
variant.getMergedFlavor().applicationId = pkgDataEntry.pkg
So that the final merged manifest file does have the package attribute.
The error occurs here(#react-native-community/cli-platform-android/build/config/index.js):
const packageName = userConfig.packageName || getPackageName(manifest);
if (!packageName) {
throw new Error(`Package name not found in ${manifestPath}`);
}
Is there a way to make RN read the merged manifest file?
If not, how can I modify userConfig to contain the package name? I couldn`t find anything about it in the docs.
Thank you
For me, the solution was to add the "package" tag to the manifest tag.
I didn't have to create another dummy folder.
The manifest open tag now looks like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourProjectName">
If anybody encounters the same issue, when having multiple flavors and AndroidManifest.xml files,here`s my conclusion:
RN has some kind of a bug that it requires the first folder alphabetically, in android/app/src, which has AndroidManifest.xml file,to have the package attribute. Otherwise, it will throw an error.
A simple solution would be to create a dummy folder, e.g aaa (first alphabetically) and to create AndroidManifest.xml inside of it, with the following attribute - package:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="aaa"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission
android:name="android.permission.GET_ACCOUNTS"
tools:node="remove"/>
</manifest>
For me, this error start after upgrade the sdkVersion from 31 to 33 and gradle version.
I did check the changes in git, and notice that the package attribute was removed from AndroidManifest.xml.
So I did add this attribute again.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.yourpackage">
I am using cordova cli for creating android app.
I have user cordova_plugin_file_chooser
Where it given that below
Note that like a ContentProvider, the DocumentProvider authority must be unique. You should change com.ianhanniballake.localstorage.documents in your Manifest, as well as the LocalStorageProvider.AUTHORITY field.
By above I have update in my AndroidManifest by changing android:authorities="com.crypho.localstorage.documents" to com.12345.localstorate.documents but when I build app using cordova build android it added new instance in manifest file with existing name android:authorities="com.crypho.localstorage.documents"
Can anybody know where should I changed in the code exactly?
UPDATE:
Still not resolved the issue of provider name confict.
I resolved issue by replacing provider authorities by ${applicationID}.Provider in <provider> of that specific plugin in android.json file.
Thanks
Just updated to the latest version of Android Studio and i get this error in the AndroidManifest file
Manifest merger failed : Attribute application#icon value=(#drawable/project_launcher_icon) from AndroidManifest.xml:48:9
is also present at com.github.anupcowkur:reservoir:1.1.1:6:45 value=(#drawable/ic_launcher)
Suggestion: add 'tools:replace="icon"' to element at AndroidManifest.xml:44:5 to override
I tried adding tools:replace="#drawable/ic_drawer" in my manifest but i get this error:
Error:(44, 5) tools:replace specified at line:44 for attribute tools:drawable/ic_drawer, but no new value specified
Any ideas?
Following Android Studio's suggestion and adding the following attribute tools:replace="icon" should allow it to build your app successfully, without resorting to using the old manifest merger (which isn't a very forward-looking solution indeed).
Of course, you'll first have to declare the namespace "tools" in order to use it:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.sample.app" >
You should add tools:replace="icon", just like the error message says.
Additional attributes can be replaced using the syntax tools:replace="icon,name,theme"
look here:
All markers belong to the Android tools namespace, therefore you must declare the namespace in any AndroidManifest.xml containing at least one marker :
xmlns:tools="http://schemas.android.com/tools"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.tests.flavorlib.app"
**xmlns:tools="http://schemas.android.com/tools"**>
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
**tools:replace=”icon, label”**/>
</manifest>
you should add xlms:tools and tools:replace those two lines in manifest file.
Android Studio 0.6 use the new manifest merger tool. This new merger was introduced in version 0.10 of the plugin. As of 0.11, this tool is used by default by the gradle plugin.
In order to revert to the old manifest merger, please add to your build.gradle the following configuration :
android {
useOldManifestMerger true
}
For me this worked. Try adding the code in the main module(project) manifest file:
add
xmlns:tools="http://schemas.android.com/tools" in your manifest tag
add
tools:replace="android:icon,android:label,android:theme" in your application tag
These will let Android Studio know that the icon, label and theme to be used are from that manifest and not from other projects included.
I currently have this in my AndroidManifest.xml
uses-library android:name="com.google.android.maps" android:required = "false"
The specified requirement of google map api is not compulsory. (This enables me to install my application on an none-google-api emulator)
However, this only works for API level 7, Platform 2.1
It doesn't work for API level 4, Platform 1.6
I am getting an error message when I am compiling - " No resource identifier found for attribute 'required" in package 'android'
But, when I looked at the documentation here:
http://developer.android.com/guide/topics/manifest/uses-feature-element.html
The attribute 'required' is introduced since level 4.
Could somebody help me out!
Thanks Aillyn
I think it impossible to include required attribute in uses-library tag.
Is there a way to include uses-library in the java code rather than in the AndroidManifest.xml??
Looks like Android doc got updated:
attributes:
android:required
Boolean value that indicates whether the application requires the library specified by android:name:
"true": The application does not function without this library. The system will not allow the application on a device that does not have the library.
"false": The application can use the library if present, but is designed to function without it if necessary. The system will allow the application to be installed, even if the library is not present. If you use "false", you are responsible for checking at runtime that the library is available.
To check for a library, you can use reflection to determine if a particular class is available.
The default is "true".
Introduced in: API Level 7.
http://developer.android.com/guide/topics/manifest/uses-library-element.html
uses-library has no required attribute. From Android docs:
<uses-library android:name="string" />
And you should use that for Google maps. From Google's docs:
<uses-library android:name="com.google.android.maps" />
The one that has the required attribute is uses-feature
<uses-feature android:glEsVersion="integer"
android:name="string"
android:required=["true" | "false"] />