Android Studio - Access resources from another package in manifest file - android

I am implementing an Android application that has both live and office packages other then the main package. The manifest file is included inside the main package. The ic_launcher and app_name resources are included in both live and office for production and development versions, respectively.
When I try to access ic_launcher and app_name from the manifest file, it fails to read them - as show in this screen shot -.
This is the hierarchy of my app:
The resources I try to access are included under both live and office directories.
Is there anything I should add to be able to access them from manifest file?

Related

Is it possible to include internal/external storage directories such as the Android Downloads or Documents folders in the Gradle Source Sets?

So I am developing an Android App that incorporates a Python Interpreter, one from Chaquopy, and one of the requirements inorder to run any scripts is for the .py files with the code to be included or rather be in any of the default or predefined source set directories/folders. This works well if the .py files are included/bundled in with the APK file but this presents a challenge in that the files now become read-only files at run-time since they cannot be modified when the app is running or has been installed.
The app is to allow the users to create, save code, and read from .py files that they would have created, but then the challenge now is that the files will be included in the directories such as the Android Downloads or Documents folder or the apps' internal files folder and as such they cannot be run in the application since it requires that they be saved in any of the source set directories, as the interpreter will look for them there.
I have tried to incorporate the 3 directories in this way, using their respective paths `
sourceSets {
main {
python.srcDir "/src/main/assets" //this works for asset files, the rest don't
python.srcDir sdk_gphone_x86/storage/emulated/0/Android/data/com.tendaik.chaquo_trial_2/files"
pyrthon.srcDir "/storage/emulated/0/document"
python.srcDir "/storage/emulated/0/Android/data/com.tendaik.chaquo_trial_2/files"
python.srcDir "storage/emulated/0/Android/download"
}
`
But all to no avail unfortunately, as this only succeeds in creating and including these directories in the project as project directories instead of accessing the directories from the internal storage, as shown in the image. All premissions to access the folders/directories are included in the Manifest file as well
How then can I include the internal storage directories as part of the source sets, if it is possible?
You can't list Android device paths in the build.gradle file, because that file only controls the build process: it has no effect on the runtime value of sys.path.
However, there are various ways you can dynamically load Python code at runtime:
If the code is in the internal storage directory, then you can simply add its location to sys.path.
As it says in this FAQ, the external storage folder (which contains Downloads and so on) cannot be accessed directly in recent versions of Android, so adding it to sys.path won't work. Instead, by following the example in the FAQ, you can use the system file picker to get the content of any file, and then do whatever you want with that content, such as passing it to exec.

How to package and send an android app

I have used Android Studio to build my Android App. I have found numerous tutorials for generating the apk file, but now that I have done that how do I send my app to somebody? The apk file is called app-release.apk. It doesn't even show the name of my app. Can I change the name? Can I package it somehow and add an image?
The APK is the file that you use to install an app in some Android device. If you have an APK file, it is already packaged, just send it to your friend.
And yes, you can change the file name, but that will not have any kind of effect on the app, it is just changing the file name...
What do you mean by package it??
You can surely change the name by RENAMING it . And as for the icon you can add an image to the drawable folder and then set the icon for it.
The icon can be set in the ActivityManifest file. Here is how to do it--
In the android manifest file there is a android:icon just set the location of your image .
https://i.stack.imgur.com/1x30x.png
The name of the application is stored in your AndroidManifest.xml file
<application
android:label="NAME OF APPLICATION"
You can rename the .APK file to anything you like, it does not change the name of the application.
The APK file can be sent to others for installation.
The apk file is only recognized on an android system. Any other system (Windows for example) wouldn't bother trying to show the app's icon even if you set it properly in the manifest. As for renaming it, you can rename it to whatever you want as long as you keep the apk extension. The real app name that will show when installed is set in your manifest file. And packaging it? you already done that by generating the apk! However if the person receiving your app wants to install it, it has to enable "Unknown sources" in Setting > Security > Unknown sources as your application is not coming from the play store.

Include APK and files in an android ROM compiled from source

I am compiling a ROM from source (say CM12.1)
I have obtained the source code and am ready to build.
However I wish to add an app (say ES file explorer) as a user app and another app(say Titanium) as a system app. Also I need to copy a file to one of the system folders.
How is this done?
I dont have the source code of those apps and hence cant compile from
source.
You will have to add the source code of the app the the packages/apps folder. Remove any precompiled files that exist.
Add the android.mk file. You can copy from it from the already available apps in the packages/apps folder and customize it for your app.
Add the app name to core.mk file in build/target/product
Build the ROM and it should have your file.

Is it possible to have few root folders for one application? Android

Is it possible to have few root folders for one application?
For example i have package com.xxx.yyy and package com.zzz.ooo in one .apk.
So is it possible to have two root folders like /data/data/com.xxx.yyy and /data/data/com.zzz.ooo ?
Thanks
It will base the package name on your file system of the package="com.packagename.android" in your AndroidManifest.xml file.
So although you can have as many different java packages in your src these are dex'd, the android package is only set from your AndroidManifest.xml.
Reason is that your resource files are generated to a singular package.
Different build system this might be possible.. but not currently with ADT/Ant.

Uploading MonoDroid app to Android Market

I am trying to load an app to the Android Market. Below are the instructions I am using from the following website to prepare my application for submission:
http://android.xamarin.com/Documentation/Guides/Preparing_Package_for_Android_Marketplace
This following message is at the beginning of the instructions. But no instructions on how to add this to the AndroidManifest.xml file.
In order for the Android Market to accept your application, it must
define an application level icon. Ensure a line like this
exists in your AndroidManifest.xml:
<application android:label="MyApplication" android:icon="#drawable/icon">
A future release will provide better support for setting this.
The very first item has me stumped because I am getting the following error when I try to upload my application to the Market.
"The icon path specified by the manifest is not in the apk."
My question is, how do I add the application level icon statement to the manifest file?
Thanks.
p.s. The app deploys to both the emulator and local Android device in debug and release modes with no errors.
You can add a manifest file to your project by bringing up the property pages for your project, going to the Android Manifest tab, and doing the 'add AndroidManifest.xml' link.
Now there should be a file called "AndroidManifest.xml" in the Properties folder in your project.
Add the line specified to this file, replacing any existing element.
I had the same issue and it had nothing to do with the icon. I had an application class (GlobalVars extends Applications) and this was defined in the manifest as different: <application android:name=".GlobalVars" /> I deleted this and added android:name="com.example.myapp.GlobalVars" to the application declaration.
If it is the icon you may have drawable-hdpi, -ldpi, -mdpi folders, and no drawable folder. Or have a drawable folder but the icon is not in it.
Can you post the relevant snippet from your AndroidManifest.xml file? Whatever you have as the android:icon attribute ("#drawable/icon" in the example) is what the apk will be looking for. You can set this manually in the xml file, or by using the wizard in the ADT plugin for Eclipse. If this is set correctly, this means you should have a file called icon.png in one of your drawable folders. If you don't have an icon.png, can you post your folder structure?
In an app I've uploaded to the market, I have the same attribute - #drawable/icon - in my manifest, and therefore I am required to have a file called icon.png in my project. In my case, I have three different icon.png files in my various density-based drawable folders (res/drawable-hdpi, res/drawable-mdpi, res/drawable-ldpi). In your case, you need to at least have res/drawable/icon.png.
This error can also be generated if the manifest xml includes more than one < application > node.

Categories

Resources