Basically the universal apk is the normal apk with x64 libs uncompressed so it delivers everything and works on every device.
Im trying to make google deliver this Universal apk instead of Master apk they deliver.
First to disable all abi splits and to make uncompressed libs i make this:
Building AAB using aapt2 and bundletool
in Bundletool i use this config.json
{
"optimizations": {
"splitsConfig": {
"splitDimension": [
{
"value": "ABI",
"negate": true
},
{
"value": "SCREEN_DENSITY",
"negate": true
},
{
"value": "LANGUAGE",
"negate": true
}
]
}
},
"compression": {
"uncompressedGlob": ["lib/arm64-v8a/**"]
}
}
It creates one standalone APK but it isnt the universal apk i need.
Any other thoughts on how to achive this?
Related
I recently updated our Expo project from sdk 44 to 46.
During that process, I switched from Expo build:android to eas build -p android.
Everything is running as expected, except the version code is not compiled into the aab/apk files correctly, so I cant push updates to google play.
The version code is already set to 26, as we did release previous versions, and the semVer is 1.1.1 currently. EAS also doesn't show the correct version codes in the dashboard.
I tried setting "appVersionSource": "local" as well as "remote", but neither works. (As far as I understand, local should be the correct parameter.
eas build generally seems to ignore other parameters from the app.config.js, like the splash images, app icons and background colors (I didn't include those lines in the code examples below to keep it short)
eas.json
{
"cli": {
"version": ">= 2.3.0",
"appVersionSource": "local"
},
"build": {
...
"production": {
"channel": "production",
"env": {
"APP_ENV": "production"
},
"android": {
"buildType": "app-bundle",
"image": "latest"
}
}
},
"submit": {
"production": {}
}
}
app.config.js
import 'dotenv/config';
module.exports = {
expo: {
name: '...',
slug: '...',
version: '1.1.1',
assetBundlePatterns: ['**/*'],
android: {
package: '...',
versionCode: 26,
softwareKeyboardLayoutMode: 'pan',
},
extra: {
eas: {
projectId: '...',
},
releaseChannel: process.env.APP_ENV,
},
},
};
Eas showing the wrong version nr
Try running npx expo prebuild or npx expo run:android That would generate the native Android project, which is basically like the Bare workflow.
See the following post for some more details and what you can do:
https://forums.expo.dev/t/should-i-exclude-ios/63094/4
If this helped you I would really appreciate it if you mark this as the answer. Thanks :)
I am trying to use the sample code located here - https://github.com/android/app-bundle-samples/tree/main/PlayAssetDelivery/NativeSample to get an understanding of App Bundles.
According to the documentation when the minSDK Version is less than 21, the Bundle shall generate standalone apks for every ABI-DPI combination. In this case when we are generating the standalone apks using the following command -
Bundletool build-apks --bundle=Teapot-release.aab --output=output.apks
Bundletool Version - 1.11.0
The Standalones folder just generates a single standalone apk.
On debugging further it seems like the bundle config has this set for Standalone Dimensions -
"standaloneConfig": {
"splitDimension": [{
"value": "ABI",
"negate": true
}, {
"value": "SCREEN_DENSITY",
"negate": true
}, {
"value": "LANGUAGE",
"negate": true
}, {
"value": "TEXTURE_COMPRESSION_FORMAT",
"negate": true
}],
"strip64BitLibraries": true
}
},
However when I set the minSdk value >=21, in that case the StandaloneConfig is empty. I donot see a place where these standalone configuration is being set. Am I missing something over here?
We are developing a COSU app using Android Management API and QR code provisioning. We're planning to distribute app with private Google play, but for now I'm trying to make it work with manual installation using apk. That's how it should work:
A client receives qr code from us, that applies policy without restrictions to the device.
After provisioning client downloads apk from some other source (probably via email) and installs it.
Client applies policy with restrictions from app with call to API.
So, I'm stuck on second step - an attempt to install downloaded apk leads to this error:
Default policy seems to be ok:
{
"name": "enterprises/<enterpriseName>/policies/policy_unlocked",
"version": "11",
"applications": [
{
"packageName": "com.axmor.fsinphone",
"installType": "AVAILABLE",
"defaultPermissionPolicy": "GRANT"
}
],
"persistentPreferredActivities": [
{
"receiverActivity": "com.axmor.fsinphone",
"actions": [
"android.intent.action.MAIN"
]
}
],
"systemUpdate": {
"type": "WINDOWED",
"startMinutes": 120,
"endMinutes": 240
},
"debuggingFeaturesAllowed": true
}
]
}
And this policy is applied to device:
"policyName": "enterprises/<enterpriseName>/policies/policy_unlocked",
"appliedPolicyName": "enterprises/<enterpriseName>/policies/policy_unlocked",
What I've tried:
Installing release apk and signed apk (same result)
Installing apk with adb from Android studio - this works, but it's not what I want.
(copying the solution here from comments)
To be able to install apps from outside the Play Store you need to set installUnknownSourcesAllowed to true in the Policy. More details in the policy references.
I am creating a public android project and I am using Google Sign-In service. I am doing it according to this tutorial. As it says, I have got the google-services.json file.
Do I need to commit the above file to Github?
Do other developers (If someone contributes) need this file?
Or, do they have to create there own?
By the way I am using Travis-CI. Will this file affect to CI build?
You can create a new build variant and store a template google-services.json to be used for your build on your CI platform in your app build.gradle.
Use a different google-services.json for the new dev build variant (see this post). Add the following google-services.json template to app/src/dev folder :
{
"project_info": {
"project_number": "",
"project_id": ""
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:123456789012:android:1234567890123456",
"android_client_info": {
"package_name": "com.your.package"
}
},
"oauth_client": [
{
"client_id": "",
"client_type": 3
},
{
"client_id": "",
"client_type": 1,
"android_info": {
"package_name": "com.your.package",
"certificate_hash": ""
}
}
],
"api_key": [
{
"current_key": ""
}
],
"services": {
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": ""
}
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
}
],
"configuration_version": "1"
}
Note that I have extended this google-services in case you also use Google Analytics or GCM service.
You would have the following configuration :
app/
├── src/
│ ├── main/
│ └── dev/
│ └── google-services.json
├── google-services.json
└── build.gradle
You can use either :
a new build type
a new product flavor (if you already have existing ones)
Build Type
Add the following build type:
buildTypes {
dev {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
We don't need to build this "dev" build variant in regular build, so you can exclude this variant if a parameter is not specified. Add the following to your app build.gradle :
def build_param = "${build}";
if (build_param != "dev") {
//exclude production build
android.variantFilter { variant ->
if (variant.buildType.name.equals('dev')) {
variant.setIgnore(true);
}
}
} else {
//exclude all except production build
android.variantFilter { variant ->
if (!variant.buildType.name.equals('dev')) {
variant.setIgnore(true);
}
}
}
Product flavor
Add the dev product flavor to existing ones :
productFlavors {
full {
}
dev {
}
}
To remove this dev product flavor from the regular build :
def build_param = "${build}";
if (build_param != "dev") {
//exclude dev
android.variantFilter { variant ->
if (variant.getFlavors().get(0).name.equals('dev')) {
variant.setIgnore(true);
}
}
} else {
//exclude all but dev
android.variantFilter { variant ->
if (!variant.getFlavors().get(0).name.equals('dev')) {
variant.setIgnore(true);
}
}
}
Eventually, add your app module google-services.json to .gitignore :
app/google-services.json
We have previously ensured that this dev variant will only be used when parameter build=dev is specified
Edit .travis.yml to modify the build config :
script:
- ./gradlew clean build -Pbuild=dev
-Pbuild=dev will only build dev build variant using google-services.json located in app/src/dev/google-services.json
Take a look at this sample project which is using google-services Google project
In Travis log, you can see that the JSON file being parsed is the one for the dev build variant :
Parsing json file: /home/travis/build/bertrandmartel/android-googlesignin/app/src/dev/google-services.json
Extra Note
Note that this method is not limited to CI and can be extended for your production build when you require a production google-services.json or a different AndroidManifest.xml (with some specific properties like fabric.io key)
Check this method to prevent commitment of fabric keys embedded in AndroidManifest.xml (and can't be imported from gradle) that is using a different build variant and using a parameter to enable the production build.
You can use travis encrypt-file google-services.json
Documentation
You can do it by:
installed the Travis CI Command Line Client by running $ gem install travis.
logged in to Travis CI using $ travis login or $ travis login --pro
$ travis encrypt-file super_secret.txt
encrypting super_secret.txt for rkh/travis-encrypt-file-example
storing result as super_secret.txt.enc
storing secure env variables for decryption
Then it will print on the console this:
openssl aes-256-cbc -K $encrypted_0a6446eb3ae3_key -iv $encrypted_0a6446eb3ae3_iv -in super_secret.txt.enc -out super_secret.txt -d
You can copy it to your .travis.yml file as I did here
Do not forget to put your .enc file on your GitHub repository.
If you have multiple files, you could zip them and then you unzip the decrypted file on the Travis ci.
For instance, you can do like this:
$ tar cvf secrets.tar foo bar
$ travis encrypt-file secrets.tar
$ vi .travis.yml
$ git add secrets.tar.enc .travis.yml
$ git commit -m 'use secret archive'
$ git push
I did it.
In my case, I had two files to use on the build of my app. So, I used this due to travis does not support multiple encrypted files. Therefore, you zip then on one file and encrypt this file.
You can have a look at my travis script here
Firebase Documentation says:
"For open source projects, we generally do not recommend including the app's Firebase config file or object in source control because, in most cases, your users should create their own Firebase projects and point their apps to their own Firebase resources (via their own Firebase config file or object)."
https://firebase.google.com/docs/projects/learn-more?authuser=0#config-files-objects
Firebase documentation seems to imply that there is no problem in committing the file to GitHub.
Here is an extract from the docs
The Firebase config file contains unique, but non-secret identifiers for your project. To learn more about this config file, visit Understand Firebase Projects.
i create a simple memory game with the last version of cocos code IDE(v1.2.0) and last version of cocos2d-JS(v3.3) and it work fine on the WEB and also work well when i debug it to an android simulator(BlueStack) and my android device, BUT when i have to debug it on BlueStack the following error appear in the IDE consol: JS: /data/data/org.cocos2dx.PrebuiltRuntimeJs/files/debugruntime/script/jsb_create_apis.js:910:Error: js_cocos2dx_LabelTTF_create : wrong number of arguments so i delete all argument for cc.LabelTTF.create except text, fontName, fontSize to debug the game correctly.
(source: cocos2d-x.org)
i get this alert box when i want to package to APK.(i clicked YES)
(source: cocos2d-x.org)
Now, after i get the APK file (result of package the game to apk), i get a black screen that show only the FPS on both BlueStack and my android device.
Note that when i package the default HelloWolrd project it works correctly without this problem.
(source: cocos2d-x.org)
i use the last version of ant(v1.9.4) and NDK r9d
also when i debug the apk file generated form package to apk option i just got this line in the console:
Start LaunchActivity org.example.concentration/org.cocos2dx.javascript.AppActivity
and the black screen with the FPS appear on the emulator and android device. so i can't see what happen.
i also check the content of build-cfg.json file and this why i get.
{
"ndk_module_path" :[
"../../js-bindings",
"../../js-bindings/cocos2d-x",
"../../js-bindings/cocos2d-x/cocos",
"../../js-bindings/cocos2d-x/external"
],
"copy_resources": [
{
"from": "../../../src",
"to": "src"
},
{
"from": "../../../res",
"to": "res"
},
{
"from": "../../../main.js",
"to": ""
}
],
"must_copy_resources": [
{
"from": "../../js-bindings/bindings/script",
"to": "script"
},
{
"from": "../../../config.json",
"to": ""
},
{
"from": "../../../project.json",
"to": ""
}
]
}
and when i unpacked the apk file i found the resources too.
(source: cocos2d-x.org)
the pictures are in the assets folder.
this is exactly the same structure as the default Hello World simple project created by cocos IDE.
(the only difference is that the default project work after packaging and my game doesn't!)
How can i solve this problem?
thanks in advance.