Custom building of APK - android

is there any way how to change, via changes in build.xml file, package name in time of build? Is it even possible?

Related

Files under the build folder are generated and shouldn't be edited

I want to know if there is any way to edit the BuildConfig.java file in Android Studio, as there is an error when I try to change a variable in that file. It says:
Files under the build folder are generated and shouldn't be edited.
Every time I change the variable and build the project, it returns to the old one.
I want to know if there is any way to edit "BuildConfig.java" file in Android Studio
No. That is generated for you on each build.
However, depending on what it is that you are really trying to solve, you may be able to make changes in your module's build.gradle file that affect what goes into BuildConfig.

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.

Editing an APK file's resources from Android

I want to edit the resources of an APK file from WITHIN Android. I know how to do it with ApkTool in windows/linux, but I'm having problems doing it in an Android app itself.
In particular, I need to add a few files to the resouces, edit the AndroidManifest.xml and put the files back in the APK.
I know APKs are simply zip files, but the resources and manifest inside them are "compiled" in binary format so they cannot be edited directly, so I need some kind of library or tool for Android that can decompile the resources and then put them back in the APK.
I know this can be done, since apps like APK Editor do it (and without needing root!) but I can't find any documentation on how to do it myself.
I used this library for parsing an APK.

md5sum of apk changes after every build

Why does the md5sum value of an apk change after every build?
Every time i build my Android application in the Eclipse IDE using the Android Tools -> Export Signed Application package, i get an apk file that gives a different md5sum value. If i have not changed any of the source code, shouldn't the apk files give the exact same md5sum? This happens even if i build it just seconds apart. What is going on?
The individual files should compile with the same CRC. An APK however is like a zip file containing all your files and those files are stored with a timestamp. The timestamp will be different for each compile and this is what changes your md5sum.

How do I use Ant to build multiple Android APKs with the same code base, but with different resource files?

I am trying to build a branded Android app, that will have different resource files (mainly drawables) for different customers. The Java code in the apps will be the same, but the different apps will have a different look--meaning different color schemes and different logos etc. I have been told, and my research suggests that Ant is the best way to achieve this.
Where should I change the Android 'build.xml' file? What sort of Ant task should I use to achieve this?
For debugging, I would like to just use Eclipse and build with the default resources. But for production releases, I would like to run Ant on build.xml to produce multiple APKs from different /res folders. I do not even need any code snippets (although that would be nice), just even some tips from people that have done this before or something similar.
I ended up writing a Python script to reorganize the Android project before each build. I recommend avoiding the use of Ant for stuff like this. My 100-200 lines of Python achieved the equivalent of about 1000+ extra lines of Ant that was required in addition to the default Android build.xml Ant script.
I have encountered a similar issue where I want to compile the same code base with some changes as well as changes in the resource files. The solution I am pursuing at the moment is creating a library with the shared code/resources and separate "regular" projects for each of the different APK releases. Unfortunately, I don't have a functional final solution to the problem yet, so all I can give is these vague hints.
Requirement Setup
1. Go to the URL :
http://ant.apache.org/bindownload.cgi
and download the apache ant and extract it in to the any folder like d:/ant .
2. I think you already having the Android SDK path is like(D:/Android SDK/)
Now go to the Enviroment variables and check whether path variable is there is there add these in path otherwise create a new varible with name path and put it there in vaue
D:/ant/bin;D:/Android SDK/tools
done
Go to command prompt and navigate it to the root directory of your project and run the command
android update project -p /
Note: / if you are in the root directory of project else you need to give the path of root directory like d:/myworkspace/mysampleproject
this will generate and build.xml file in your project.
now run the command for this it is necessary to be in root directory of your project
ant debug
this will generate an apk file in bin folder signed with default debug key.

Categories

Resources