I keep getting the following error when uploading an app to google play:..
You uploaded an APK or android App Bundle which specifies an actions schema document in its manifest, but action schemas are not yet allowed. If you are part of a beta program, you need to have your developer account whitelisted.
I have applied to become whitelisted, but when I filled out the form my app did not meet the criteria for an specific 'type' (it is not a financial program etc.)
Most of the articles I have read say this relates to meta data content which some say can be deleted... my app however, will not work without the metadata content.
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
and here is the resource file_paths
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path
name="ConfinedSpace_images"
path="Android/data/com.mynamehere.confinedspacemanagement/files/Pictures" />
</paths> ```
Does anyone know of a workaround?
It seems there is no getting around the google whitelist problem. I also found that my manifest had two areas of meta-data in it. The file system seems to be fine, but the following code seems to be where my problem is originating
<meta-data
android:name="com.google.android.actions"
android:resource="#xml/file_paths" />
I have deleted the meta data above and things still seems to work. I am curious though... where did the code come from, and more importantly.... what does it do? I openly admit I am still somewhat of a copy and paste programmer.
My problem now is that my camera will not work in my app???? any advice?
Update Dec 2/2019 ----- Camera now works fine. My problem was that the xml file_path resource wasn't changed... it was still trying to save to com.example.-----------
Related
I have just started my android journey with the help of a book. Which is not recommended but it is my preferred method of learning. In this book when I get to examine the layout file .xml the book says that this pre-made file starts and ends with
<RelativeLayout> ... </RelativeLayout>
but in the android manifest file I was given, I noticed the contents were similar but started and ended with a
<manifest> ... </manifest>
so are these two pieces of code the same, are they interchangeable, how can this confuse me in the future, and can this Error make the book I am using obsolete. (The book is called "Android Programming for Beginners" by John Horton)
Xml is a file type, and is used for several things in Android development.
The Manifest.xml file is the App's configuration xml file.
It describes essential information about your app to the Android build tools, the Android operating system, and Google Play.It's used also to declare:
The app's package name, which usually matches your code's namespace
the components of the app, which include all activities, services, broadcast receivers and content providers
....
and Many more...
So it's not a layout file what they are talking about in the book.
They are talking about Layout files.
The Layout files (.xml files also) are used to create the designs, you can use several tags according to your need inside those design.xml files:
Examples of Android xml design tags:
<RelativeLayout ... </RelativeLayout>
<LinearLayout ... </LinearLayout>
<FrameLayout ... </FrameLayout>
<ScrollView ... </ScrollView>
<TextView ... </TextView>
<ImageView ... </ImageView>
And many more...
They are two different xml file so they are not interchangeable
Regarding the book:I checked it, it's very good, but i think if you start with video tutorial first then go back to the book after 2 weeks you're gonna save a lot of time later and you will be able to understand the book better.
Keep learning, Good luck
No they are not the same.
You can read more about the Android Manifest file here, but it is basically a file which describes essential information about your app to the Android build tools, the Android operating system, and Google Play.
The .xml file, which starts with
<RelativeLayout> ... </RelativeLayout>
is for building the frontend in Android. You can read more about this topic here.
Is it possible to specify some information, such as API keys, in a file, and then somehow inject this information into the AndroidManifest file (maybe during the build process)?
For my particular use case, the documentation for react-native-maps requires adding a Google Maps API key to the AndroidManifest file. However, I'd like to keep sensitive information out of the AndroidManifest file (instead, inside a file that will eventually be gitignored for example).
On a side note, from this question, it seems that all information inside the AndroidManifest is available to all packages on the same device. Is this still true?
If the information is only needed in the manifest, you can define manifest placeholders in your build.gradle file and reference them using ${} macro syntax in the manifest.
If the information might be needed elsewhere, consider using string resources created via resConfig in your build.gradle file.
The build.gradle file can pull the actual values from gradle.properties, a custom properties file, via some API call to a server, or whatever else you want, given sufficient Gradle/Groovy/Java coding. Typically, I have gradle.properties listed in .gitignore, and so I put this sort of thing in there, though I am not certain if that approach is common practice.
it seems that all information inside the AndroidManifest is available to all packages on the same device. Is this still true?
"All" is a strong term, but I would say that the vast majority of information in the manifest is visible through PackageManager. Sometimes, it's not directly accessible (e.g., I don't recall a way to get the <intent-filter> list for a component), but it's still there if you find the right way to get at it.
I've run into the FileUriExposedException stuff where you try to send a file:/// Uri to another app (in this case the camera), and I should be using a FileProvider instead (causes a crash on api 24 Nougat).
In our app, we generate a File using Context's getExternalFilesDir(String) method:
context.getExternalFilesDir("attachments");
The FileProvider documentation leads me to believe I should be using external-files-path in my paths.xml if I want the functionality to be the same as is now.
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-files-path
name="attachments"
path="attachments/" />
</paths>
But after googling some more, I found a few things that make me think there's issues with FileProvider, or at least FileProvider's documentation...
https://code.google.com/p/android/issues/detail?id=61170
#commonsWare
answer and comment https://stackoverflow.com/a/30276915/921988
The README of this active library that says it adds support for external-files-dir https://github.com/commonsguy/cwac-provider#metadata-elements
Also, I'm getting java.lang.IllegalArgumentException: Failed to find configured root that contains ... right now, but that might be caused by something else.
So
Am I right in thinking I should use external-files-path if I want to match how my app currently works?
Is the documentation/FileProvider really broken/incorrect and I should use something like cwac-provider instead?
UPDATE
For completeness, as #CommonsWare recommended below, using the 24.2.0 version of support-v4 is working for me.
Am I right in thinking I should use external-files-path if I want to match how my app currently works?
Yes. Though do note that getExternalFilesDir() does not officially support "attachments" as a parameter, so do not be surprised if your app breaks someday.
Is the documentation/FileProvider really broken/incorrect
Well, I see the code for external-files-path support in the sources JAR for 24.2.0 of the new support-core-utils artifact. support-v4, as of 24.2.0, has been subdivided into a series of separate artifacts, and FileProvider lives in support-core-utils.
So, try using 24.2.0 of support-v4 (or support-core-utils if you do not need all of support-v4).
I had similar scenario of sharing a private file to the camera to upload full quality image without putting a permission to WRITE_EXTERNAL_STORAGE.
I was able to make it work by using the as follows
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
name="my_images"
path="Android/data/com.santhoshn.appprivateimageupload/files/Pictures" />
</paths>
Here is the working sample app https://github.com/santbob/AppPrivateImageUpload
I'm trying to associate my App with my custom file extension.
like here
I did succeed, but now, my App want to open for every files, pdf..., or wathever. My custom files don't have a specific minetype, so i'm trying with different pathPattern combinations but didn't find anything working on Android 4.
<data android:pathPattern=".*\\.custom" />
This worked good on Android 2.3.3, but badly not on v4.
What am i supposed to do, to make it work ? Any tips ? Thanks !
Ok i finally managed to make it work better, i'm still not fully understanding how the manifest intent filters are supposed to work, but here is what i did:
Intent intercept app showed me the mimetype of my files: "text/plain" so first i did is to add:
<data android:mimeType="text/plain" >
So, at this point, my App is not showing for every files anymore.
Then, when i'm creating the file, i added: sendIntent.setType("application/custom");
and i added in manifest file the corresponding mimetype.
This way worked good on both Android 2 and 4 phones i tested.
If someone found or wrote something about how intent-filter is exactly working, please let me know !
For my personal purposes I'd like to parse comments in Android Manifest file. In these comments there can be tags with attributes and values that I want to extract. It is similar to tag in html files that is usually commented because some browsers does not support this tag. So I want to implement similar things in android manifest.
I know that in Android manifest file is parsed using SAXParser. Moreover, I think I should use LexicalHandler for this purposes but I've never faced before with this functionality and I want to know how to do this. Code snippets and any help will be highly appreciated!
I'm entirely sure that you cannot parse the raw XML Manifest, because like everything that is in the res folder (except res/raw), the manifest is compiled and stored in a binary format, so the comments are removed.
Maybe you can play with xmlns and capture the manifest parsing... But I doubt it, the Manifest is interpreted by the package manager, and I don't think that you can have access to it.
The solution (from your feedbacks):
The requested feature is impossible, because during the compilation all comments from AndroidManifest file are removed.
You can check this in the following way:
Create a simple app project (Hello World) and add comments in your AndroidManifest file.
Compile project and export an .apk file (signed or unsigned).
Using tools like apktool or similar extract your apk file.
Check the result in AndroidManifest.xml - there are no comments.
You should try to find other way.
I don't think it is possible as the AndroidManifest is not available as a classpath resource. The only way I can think of is to actually make a copy of the AndroidManifest.xml into your source files and have it built as a compiled object using an ant target
Then you just access it like a normal XML file using the XML APIs.
I hate to be that guy, but you should probably maintain your custom XML in /assets/ and not overload the manifest.xml file.