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.
Related
When publishing a MAUI app for iOS, I can either use
<IpaPackageName>IPA.ipa</IpaPackageName>
in the project file or add -p:IpaPackageName=IPA.ipa to the dotnet publish command to change the filename of the distribution package. I didn't find much documentation but it's obvious once you change it in the project properties:
What is the equivalent setting for Android? I can't find a way in the UI to change the APK filename.
In visual studio
1.Go to project Properties by right clicking the android project; Switch to tab Android - Manifest; You will see the Application package name just as follows, then you can modify the name of it.
2.Go to Android Manifest.
You said that changes the application identifier as well. It seems to be the default setting. About it, you can refer to Configure the app module.
Some relevant cases about "change the package name", you can check Is it possible to change the package name of an Android app on Google Play? and Changing the package name of an upgraded Android application
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.
My project contains a dynamic feature called feature_login
In the AndroidManifest.xml file, I configured feature as included and NOT on demand.
<manifest ...>
<dist:module
dist:onDemand="false" dist:title="#string/title_feature_login">
<dist:fusing dist:include="true"/>
</dist:module>
</manifest>
So I assumed that the given feature will be included in the .apk file by default. But when I am generating .apk using Android Studio
seems that it doesn't contain that feature as the app is crashing as soon as I am pressing on the button which starts the feature.
But the app works when I am running it from the Android Studio on the Emulator using Run button.
Question
Are dynamic features good for a use case like Login?
How I can build debug app which contains dynamic feature?
Are dynamic features included in the .apk if dist:onDemand="false" and dist:fusing dist:include="true"?
Are dynamic features good for case when you want to have separate modules (ex. Login, Profile Details, etc) or better to use library module?
Are dynamic features good for a use case like Login?
If you can decouple dependencies from the rest of your app while still using login, sure.
How I can build debug app which contains dynamic feature?
Either through the app bundle flow using bundletool or using Android Studio.
You can also use ./gradlew assemble and then adb install-multiple with all relevant debug apks.
Are dynamic features included in the .apk if dist:onDemand="false" and dist:fusing dist:include="true"?
No. The fusing flag is relevant for .aab. APK fusing is honored when the target device runs on API < 21.
Are dynamic features good for case when you want to have separate modules (ex. Login, Profile Details, etc) or better to use library module?
I recommend using dynamic feature modules for user facing features. So e.g. Profile, Login, Shopping Cart, PremiumWhatever can be good starting points.
There are advanced use cases for saving more on device space, but these rely on delayed delivery via on demand or conditional delivery.
For more information I recommend taking a look at the Plaid sample app or watching one of the presentations on the topic.
the dynamic feature needs to use with app-bundle, not APKs.
When you debug the app, you could include the dynamic feature by modifying your existing run/debug configuration.
Firstly, select your desired Android App configuration, then
under dynamic features to deploy in the General tab, check the box next to each dynamic feature module you want to include when deploying
your app.
If Build APKs option would be selected, then it will create multiple Apks same as the number of dynamic features into your app.
But it seems the requirement is to create a single APK having all the dynamic features, so to do that
a) For debug builds :
Edit Configuration -> General -> (Look for dynamic features to deploy option) -> Select all the dynamic features to include them into the build -> Apply -> OK
b) For release builds :
Generate the signed App Bundle and follow below steps:
i) Download the Bundle tool from the below link :
https://github.com/google/bundletool/releases/download/1.5.0/bundletool-all-1.5.0.jar
ii) execute the below command in the terminal or android studio terminal in the same directory of above bundle too
java -jar bundletool-all-1.5.0.jar build-apks --bundle {path/of/yours/.aab} --output {output/path}/name-of-output.apks --ks <key-path> --key-pass pass:{key-password} --ks-key-alias {key-alias}
--ks-pass pass:{key-alias-password} --overwrite --mode=universal
Replace {} strings with your own values, after executing above command it will create a univeral .apks file. (Note it is .apks , not .apk)
iii) To install .apks into the device:
adb install -r <output/path>/name-of-output.apks
Hope it would help.
APK Files aren't recognizable files like executable files; they won’t run on a double click. That's why we need a player/emulator like Bluestacks/Andy/Droid to play them.
So what should I do to extract all the info about an APK without installing it and running it on a device?
You can get some limited information about an APK by extracting it. An APK is essentially a zip file containing manifest, resources, assets and classes which together make up the application. Change the .apk' extension to.zip` and extract it using built-in Windows tools. Note that most contents won't be human-readable.
APK-Info
APK-Info is a Windows tool to get detailed info about an apk file.
Allows you to view:
application icon
package name
name (in all languages)
version
build number
the minimum, maximum, and target version of the SDK (Android)
supported density (DPI) and screen size
architecture (ABI)
supported textures
permissions
features
signature
OpenGL ES version
whether app supports Android TV, Wear OS, and/or Android Auto
locales
a variety of hashes (MD2, MD4, MD5, SHA1, SHA256, SHA384, SHA512)
and a lot of other information
Using
You can open the APK file in APK-Info using one of the following methods:
Start APK-Info, and then select the APK file in the dialog.
Open the APK file by clicking on the open button in the dialog.
Drag the APK file to APK-Info.exe or its shortcut.
Drag the APK file into the running APK-Info window.
Open the APK file by double-clicking, after installing APK-Info, as a program for opening APK files (via explorer or attached .cmd file).
https://github.com/Enyby/APK-Info
Our company has a huge complex ant build system for building an enormous suite of dozens and dozens of android projects that all get built into a single .apk.
I would like to incorporate a wearable app into this but I don't know to get the wearable .apk embedded within the mobile .apk.
In Android Studio / Gradle this embedded is automatically handled by simply adding the wear apk as a dependency of the mobile apk within the mobile's build.gradle.
Does anybody know how to get the wear apk embedded within the mobile apk when gradle is not being used?
The Packaging Wearable Apps training has all of the steps for packaging manually:
Include all the permissions declared in the manifest file of the wearable app in the manifest file of the mobile app. For example, if you specify the VIBRATE permission for the wearable app, you must also add that permission to the mobile app.
Ensure that both the wearable and mobile APKs have the same package name and version number.
Copy the signed wearable app to your handheld project's res/raw directory. We'll refer to the APK as wearable_app.apk.
Create a res/xml/wearable_app_desc.xml file that contains the version and path information of the wearable app. For example:
<wearableApp package="wearable.app.package.name">
<versionCode>1</versionCode>
<versionName>1.0</versionName>
<rawPathResId>wearable_app</rawPathResId>
</wearableApp>
Add a meta-data tag to your handheld app's <application> tag to reference the wearable_app_desc.xml file.
<meta-data android:name="com.google.android.wearable.beta.app"
android:resource="#xml/wearable_app_desc"/>
Build and sign the handheld app.
Many of these steps can be done just a single time - the most important step is #3, in which you copy the resulting Wearable APK into the correct place before building your app.