I am working on an android project which requires me to build the android's apk file at run time, i am doing so because i need to add a text document. This is like a client server process.
When a user opens a particular ip address, at run time on server side the apk file is built with the text document. The text document contains the users master data which is unique to a single user. At the end, the android app is directly downloaded and installed on mobile phone.
If any one knows the way to do it, please let me know.
You need to do at least several things (I've done similar task in J2ME):
You have to have JDK on server side
ANT tool installed there
Some scripting tool to generate sources (as a last resort your own Java servlet)
So based on user response you should:
using scripting tool generate Java source
generate/collect necessary resources
generate AndroidManifest.xml
run on top of that ANT builder
get APK file and upload it to customer
The easiest way I can see would be to use some software like maven to build your project dynamically. This way, when you receive a request from a user, you start a build with maven and push the output to the request.
There are some nice projects of integration Android - Maven like this.
Related
I'm following this https://cloud.google.com/community/tutorials/building-android-apk-with-cloud-build-gradle-docker-image to build Android APKs via Cloud build
Already have image (with digest): gcr.io/cloud-builders/docker
Unable to find image 'gcr.io/fullstackgcp/gradle:latest' locally
/usr/bin/docker: Error response from daemon: pull access denied for gcr.io/fullstackgcp/gradle, repository does not exist or may require 'docker login'.
See '/usr/bin/docker run --help'.
Did anyone experience this as well?
This account had been suspended for billing issues (likely because people were all referring to that image, instead of hosting it themselves); I've already reported that. Meanwhile I've created another one fully working example (without making the same mistake to share the builder image): cloudbuild-android, which is just as good, if not a tad better.
Full disclosure: I've wrote that builder, because of the problem with the image.
I also had this error. Digging deeper I figured that you first need to prepare a Docker image that will build your Android app and upload that image to Google Cloud Registry. To do that I used: Cloud Builders Community:
Checkout their repository
Go to cloud-builders-community/android/
Trigger CloudBuild to build & upload a docker for you (specify the Android SDK version you need):
gcloud builds submit --config=cloudbuild.yaml --substitutions=_ANDROID_VERSION=28
At this point you should be able to use gcr.io/$PROJECT_ID/android:28 instead of gcr.io/fullstackgcp/gradle in the cloudbuild definition provided in the tutorial.
However I decided not to risk and hit the next error, so I used this one (provided by Cloud Builders Community again). They do have a step for caching the gradle build so you would also need a tar docker:
Go to cloud-builders-community/tar/ and run:
gcloud builds submit --config=cloudbuild.yaml
After all of this is done you can build your app by running the following in the app folder:
gcloud builds submit --config=cloudbuild.yaml --substitutions=_ARTIFACT_BUCKET=<your_bucket>,_CACHE_BUCKET=<your_bucket>
The trigger you have already created as part of the tutorial will also work. You just need to add the two variables above: _ARTIFACT_BUCKET and _CACHE_BUCKET
I'm working with a client who wants to deploy multiple versions of their android application (representing DEV, TEST, UAT, PROD, etc) to the same device.
Normally, with any application, I'd prefer to promote the same compiled binary code from one environment to the next. For example, if a build passed testing in TEST, I'd like to promote that exact build (perhaps with different configs) to UAT. This would be possible if the clients test environments were different devices, but given they have the same android device running multiple versions of the app, I'm wondering if there's any kind of best practice here.
The client is using Azure DevOps. Is there an easy way to build the APK as part of an Azure build pipeline, and then change its Bundle Id, or google-services.json in a release pipeline to indicate that it's a "Dev" or "QA" version of the app?
You may try to use extension 'Mobile App Tasks for iOS and Android', this extension includes tasks to change app's version name and code or app's package name at build/release time. If the extension can not satisfy your requirement, you can refer the source code, modify it and create a custom extension. Please see how to create a custom pipleline task.
I created simple Android App which sends a Person object to Android App Engine.
It works great locally: I can see all my records : http://localhost:8888/_ah/admin/datastore?kind=MessageData but now I want to upload it to real google cloud. What I suppose to do?
I have my google cosnole: https://console.developers.google.com/project/apps~boazeriasciana?authuser=0&redirected=true&utm_referrer=https:%2F%2Fwww.google.pl%2F
Where to look for my records? Is there any tutorial for THIS step?
These are my classes:
If you already created your project on app engine, all you need to do is check the configuration on your config xml file and deploy from the console.
If you are using Maven for building your code, check this resource, if you are using Gradle, you can read from step 6 on from this endpoints example.
In any case it all comes down to checking your XML file to check that config is ok and executing the command to deploy your server.
Maven:mvn appengine:update
Gradle:./gradlew todoTxtBackend:appengineUpdate
So im making a C# application which I want to be like a small configuration GUI where the user can input his own parameters and select some features, and according to those a xml file will be made and put in a prebuilt ready-to-build android project (in the asset folder). Now i'm struggling with the part where the C# application should compile the project and make a final apk. I tried to use ant but fail hard at understanding how to use it. Any help would be appreciated, but please be detailed im new to this kind of stuff.
This is a rather old question, but I'm going to answer it with my final solution.
I created a builder in C# by including the free apktool (and required files) in my project, which could decompile and compile an apk.
So what I did was after making my app, decompile it with apk tool, and then include the decompiled project with my c# project. The user generated a config file using the C# application, and it was deployed in the /assets/ folder of my app since my app expected it to be there.
Then I builded it again with apktool and signed using a debug keystore. (debug keystore is default if the user has no idea what that is, another keystore can be selected)
Keep in mind that, for this to work, the end user has to have java SE installed, I listed these 2 as "required" in my application (PC restart after installation recommended):
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
Hope this helps anyone finding this, rather old, post!
I would like to produce 2 builds of my Android app:
one build which will be as close as possible to what ends up on the Android Market when I release it, and which will be distributed to testers who do not work at my company
one build which will be tested internally by programmers at my company. This will be very similar to the other build, but will have some extra functionality, like being able to configure (at runtime) which server environment it talks to
Is there an easy way to modify my build to build both these artifacts? If I could just set a single variable's value to something passed in on the command line during the build, I could dispatch on that value in different parts of the app for different behavior. However, I'm not sure that's the best way to do this, nor do I know a good way of getting that into my code.
I'm using the off the shelf build.xml file that Android produced for me right now.
Thanks!
When you have an automatic build chain (i.e. running everything through ant), you can create one java file that contains that variable from the ant run.
And here you can set the variable depending on the target environment. The build will then compile that file with all others and package it up.
It may be possible to also have a replace task in ant, that takes an existing file and just replaces a token ##var## with the variable content.