Different module file by flavor - android

I'm trying to implement play services and huawei services in the same app, but want to be able to configure which one to use by flavor. Each flavor uses it's own applicationIdSuffix. So for each different flavor, huawei plugin fails and I cannot compile.
I have app module that contains agconnect-services.json file in it's root.
How could I specify different versions of this file for each build flavor?
If it's not possible, then in my root build.gradle file I have this line:
classpath 'com.huawei.agconnect:agcp:1.1.1.300'
Is it possible to use this line only on specific flavor?

The possible cause is that your AppGallery Connect plug-in version is not the latest one. Please upgrade it by referring to HUAWEI AppGallery Connect Guide.
To support multiple channels, you need to add the agconnect-services.json file to the folder of only the Huawei channel and ensure that the AppGallery Connect plug-in version in the project is 1.2.1.301 or later (classpath'com.huawei.agconnect:agcp:1.2.1.301'). If the plug-in version is earlier than 1.2.1.301, upgrade it to 1.2.1.301 or later. To obtain the latest AppGallery Connect plug-in version, please refer to Configuring Address Information for the AppGallery Connect SDK.
The configuration procedure is as follows:
If your app needs to support multiple build types or flavors, configure the agconnect-services.json configuration file downloaded from AppGallery Connect for your app to implement the function. The agconnect-services.json file provides configuration information required by various services in your AppGalleryConnect project. Therefore, if you need to use multiple flavors to release different app versions, copy the agconnect-services.json file to the folder of each flavor and configure it.
To support multiple build types, such as release, debug, rest, and mirror for your app, set buildTypes in the build.gradle file in the app directory. You also need to copy the agconnect-services.json file to the folder of each build type.
If your project needs to support different app packages for different channels, the package name needs to vary depending on the channel. Change the package name in productFlavor in the build.gradle file under the app directory.

Related

how to implement one google-service.json file in to multiple android project

I working on a project that develops android .apk files using phone gap.
I use different them to manage my mobile app or when it builds the app I've changed its package id in my repo. I want to use push notification in all my generated apps. I can't manually add every time google-service.json in my repo or not wan go again and again on google console to add a new project with Package Id.
You should download each play-services.json files from each project and when you build your project you should add a script or a task to swap between the files.

is keystore information really in the project files?

I want to make my Android code “open source” and this link says there is certain sensible information in the build.gradle files that should not be published:
https://developer.android.com/studio/publish/app-signing.html#secure-shared-keystore
The thing is that I cannot see such information in my build.gradle files. No passwords nor anything sensible. I sign the apk with a digital certificate by using Android Studio’s “wizard”.
Could it be that the link above is out of date and perhaps, with a new Android Studio version that sensible information is not put in the build.gradle any more? Or what am I missing?
Thanks
Android Studio doesn't add anything to your build.gradle files. The so-called 'wizard' uses standalone jarsigner, and the credentials are provided each time or cached by the IDE, so it's like you used the second method.
The first method describes a way to sign apks using a gradle task, which is also an option, but it seems, not the one you're using.
To conclude, you don't need to provide signing config to build.gradle to have the ability to sign apks. So unless you have any other secure keys in your files, you should be fine.

Does 'compile ...' in gradle requieres internet in the installation device?

I'm working on a project and using the Google GSM Vision library to read a QR Code by adding
compile 'com.google.android.gms:play-services-vision:8.4.0'
in my app gradle.
After doing it, the project syncs and now I'm able to use the lib and I can launch the app in my own device.
The problem is. What happens if the target does not have access to internet and it does not have a Google account? Will it run or the lib needs to be downloaded after or during the installation?
Thank you.
Creation of APK, mobile vision api bundled with APK. So, internet is not required and google account is not necessary.
From Doc :
Note: ProGuard directives are included in the Play services client
libraries to preserve the required classes. The Android Plugin for
Gradle automatically appends ProGuard configuration files in an AAR
(Android ARchive) package and appends that package to your ProGuard
configuration. During project creation, Android Studio automatically
creates the ProGuard configuration files and build.gradle properties
for ProGuard use. To use ProGuard with Android Studio, you must enable
the ProGuard setting in your build.gradle buildTypes. For more
information, see the ProGuard guide.
Generally, Gradle can try to connect to the web. If you have your dependency downloaded in cache you can build the app in --offline mode.

providing different publicSigningKey enteries for QA and PROD

In the application-descriptor.xml file for my application I have specified the publicSigningKey for the Android build of my hybrid app.
But, the key I'm using for QA (which results from a debug build of the app), is different than the one that will be used in production (a release build for submission to the Play Store).
What is the best way to control the signing key for the different builds?
Ideally, I would have it read in from a file instead of being inline in the xml.
The .wlapp files are being built using the app-builder ant task from the v7.0 CLI.
You could possibly create an Ant task that replaces the application-descriptor.xml file with another version of the file (for the required environment) before running the the app builder Ant task.

How to create a Delphi Android Application APK to include files

How do you include files and/or folders containing files with an Android application APK file. The Delphi run process wipes the contents of the Assets directory and the files/folders I placed there are not included in the APK package. I assume you must manually add System.StartupCopy to your .DRP unit to copy the files and/or folders to path specified by TPath.GetDocumentsPath().
Use the Project->Deployment main menu item, which allows you to put files into the installation and specify the location for them after install. See Deploying Your Final Android Application in the Android Mobile Application Development topic in the documentation.
Clicking through a little will get you to Preparing an Android Application for Deployment, which has a step-by-step list on configuring the options for deploying the app:
You must configure several options for your Android app before you build the application for distribution. The properties that you configure are bundled with your application, in the AndroidManifest.xml file. You cannot modify these properties after you build and sign your application. Because these properties provide key information about your application, you should ensure that they contain the correct values before you deploy your application, or you might have to rebuild your application in order to change the configured values.
Before each release of your Android application, you should check that every setting is properly configured.
To configure your Android app:
On the Project > Options > Application page, provide the icons and images to represent your application.
On the Project > Options > Version Info page, increase the version code of your application. Application stores such as Google Play may require that newer versions of your application always have a higher version code than previous versions.
On the Project > Options > Uses Permissions page, define the permissions that your application requires to work.
On the Project > Options > Provisioning page, select in Target the build configuration that you want to use to deploy your application (for example, Release) and provide a KeyStore file if you have not already created one. This step is necessary in order to install your application in a device that has USB debugging disabled and to distribute your application to others. For more information about keystore files, see: http://docs.oracle.com/javase/1.5.0/docs/api/java/security/KeyStore.html.
There's also a section on customizing the AndroidManifest.xml file for things like version number and name, required permissions, and so forth.

Categories

Resources