Upload Instant App problem: The configuration APKs in your Instant App APKs should have targeting information - android-instant-apps

I am developing an instant app and have an issue with uploading to play console internal track.
I successfully built bundle with ./gradlew bundleRelease command, than generated apks with bundletool with mode instant enabled and launched instant app locally with ia tool.
But when I try upload apks.zip to play console I've got an error "The configuration APKs in your Instant App APKs should have targeting information."
What does mean this message? Can it be connected with bundletool? Or could you advise how correctly upload instant app apks.zip to play console?

Add the below line in manifest tag in your manifext file
android:targetSandboxVersion="2"

The problem was in Configuration APKs. They didn't have targetSdk information. I fixed it by adding this to build.gradle
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = false
}
}

Related

How to reduce the size of an expo/react-native app on Android

I am developing a small dictionary app by using react native with expo.
As I am compiling to Apk file. The size goes up to 30mb and after having installed on a device, it goes to 80mb.
Is this normal?
Are there any ways to reduce the size of the app?
Thank you guys.
For android APK bundle using expo, you can use the following command:
expo build:android -t app-bundle
The size will be much smaller once you upload it to the play store.
This is relevant for React Native SDK 32 and earlier.
the expo is for development the app you should migrate to react-native for production
make a new react app "react-native init"
Copy the source files over from Expo project
Install all dependencies of the Expo project except Expo specific libraries.
Make necessary adjustments to app.json file
Download the signing key of your Android app from Expo using exp
fetch:android:keystore and set it up
This reduces your app dramatically you can also enable proguard and specific build for cpu architecture
buildTypes {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
for more info visit https://medium.com/#aswinmohanme/how-i-reduced-the-size-of-my-react-native-app-by-86-27be72bba640
using expo component
after you done and want publish with less size or just wan't to use a native library expo give you an option called ExpoKit this also can be used with already build with native code react projects
1-run command expo eject to add ExpoKit (choose the "ExpoKit" option)
(no need to do this if you have copied files manually or using native project)
2 -start expo packager with expo start.Leave this running and continue with the following steps.
3-
link library for android and ios, this command mostly do this react-native link, sometime this will not work and you should do it manually for this means visit expokit
PS: I didn't test this so if this not work inform me
Make following changes in build.gradle file located at:
./android/app/build.gradle
Remove x86 from abi filters.
splits {
abi {
reset()
enable true
universalApk false
include "armeabi-v7a", "x86"
}
}
Generate different APK's for different architecture
def enableSeparateBuildPerCPUArchitecture = true
Enable ProGuard :
def enableProguardInReleaseBuilds = true
Also set minifyEnabled true and shrinkResources true
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
Also, you can have different build types for development and release builds(depends on your user base)
buildTypes {
debug {
ndk {
abiFilters "armeabi-v7a", "x86"
}
....
}
release {
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
....
}
Also don't forget to remove the unused FONT Files
As of 2021, there is now a much easier option to reduce Android binary size, since ejecting/migrating to pure react-native, switching to bare workflow and building your own binaries locally requires a lot of work and study if you don't know how to do it already or don't have your environment and tools all set up.
In app.json, make the following changes:
"expo": {
...
"android": {
"enableDangerousExperimentalLeanBuilds": true
}
}
This alone should reduce app size in ~40-50% depending on your project.
There's a few things you should know about using this option, so you should read
https://github.com/expo/fyi/blob/master/managed-app-size.md. It's still WAY easier than ejecting.
on top of that, you should still use app bundles (.aab) to get another ~50% size reduction after uploading to the play store:
expo build:android -t app-bundle
the other way to reduce your app size without manually copy-paste your code in another repo. In app.json or app.config.js just set it enableDangerousExperimentalLeanBuilds to true, by doing this expo won't install the unnecessary node modules when you are running expo build:android -t app-bundle.
If you run into any crashes compare the native node modules which are installed before enabling enableDangerousExperimentalLeanBuilds and install only the required one. You can find the native node modules installed in the expo.io build artefacts.
here are some node module that come along with managed flow which you may not require
expo-ads-admob:8.3.0
expo-analytics-amplitude:8.3.1
expo-ads-facebook:8.4.0
expo-analytics-segment:9.0.0
unimodules-constants-interface:5.3.0
expo-app-auth:9.2.0
expo-apple-authentication:2.2.1
unimodules-app-loader:1.3.0
unimodules-font-interface:5.3.0
unimodules-image-loader-interface:5.3.0
unimodules-permissions-interface:5.3.0
expo-application:2.3.0
expo-av:8.6.0
expo-background-fetch:8.5.0
expo-task-manager:8.5.0
unimodules-task-manager-interface:5.3.0
expo-barcode-scanner:9.0.0
unimodules-barcode-scanner-interface:5.3.0
expo-battery:3.0.0
expo-blur:8.2.0
expo-brightness:8.3.0
expo-calendar:8.5.0
expo-camera:9.0.0
unimodules-camera-interface:5.3.0
unimodules-face-detector-interface:5.3.0
unimodules-file-system-interface:5.3.0
expo-cellular:2.3.0
expo-constants:9.2.0
expo-contacts:8.5.0
expo-crypto:8.3.0
expo-device:2.3.0
expo-document-picker:8.4.0
expo-error-recovery:1.3.0
expo-face-detector:8.3.0
expo-facebook:9.0.0
expo-file-system:9.2.0
expo-firebase-analytics:2.5.0
expo-firebase-core:1.2.0
expo-font:8.3.0
expo-gl:9.1.1
expo-gl-cpp:9.1.2
expo-gl-cpp-legacy:8.4.0
expo-google-sign-in:8.3.0
expo-haptics:8.3.0
expo-image-loader:1.2.0
expo-image-manipulator:8.3.0
expo-image-picker:9.1.1
expo-permissions:9.3.0
expo-in-app-purchases:9.0.0
expo-intent-launcher:8.3.0
expo-keep-awake:8.3.0
expo-linear-gradient:8.3.0
expo-local-authentication:9.3.0
expo-localization:9.0.0
expo-location:9.0.0
expo-mail-composer:8.4.0
expo-media-library:9.2.1
expo-module-template:8.4.0
expo-network:2.3.0
expo-notifications:0.7.2
expo-payments-stripe:8.3.0
expo-print:9.1.0
expo-screen-capture:1.1.1
expo-screen-orientation:2.0.0
expo-secure-store:9.2.0
expo-sensors:9.1.0
unimodules-sensors-interface:5.3.0
expo-sharing:8.4.1
expo-sms:8.3.1
expo-speech:8.4.0
expo-splash-screen:0.6.2
expo-sqlite:8.4.0
expo-store-review:2.2.0
expo-updates:0.3.3
expo-video-thumbnails:4.3.0
expo-web-browser:8.5.0
My suggestion will be for you to upgrade to EAS, with EAS your build size is reduced by more than 3/4, however, at this point, you have to pay $29 but I promise you it's worth it. An app I have been working on prompting into EAS reduced the bundle size from 80MB to 16MB😱. EAS also has EAS submit which enables you submit your app to the stores in a Flash
You can avoid copying the source code from the existing expo project to another project as suggested in this comment
If you use eas build (not expo build) you can try to set up enableProguardInReleaseBuilds param in app.json.
Example:
{
"expo": {
"plugins": [
[
"expo-build-properties",
{
"android": {
"enableProguardInReleaseBuilds": true,
}
}
]
]
}
}
Reference: https://docs.expo.dev/versions/latest/sdk/build-properties/#pluginconfigtypeandroid
Upgrade react-native to newer version, for different versions it is giving different size apk.
for 0.57 it was ≈12mb
for 0.59.3 it was ≈30mb
and for 0.59.9 it was ≈15mb
always try to use updated react-native version
There are basically two options for reducing size of apk file from 32mb(expo) to 7mb(react-native cli).
Detach from expo
create new react-native cli project and copy all source from expo to new react-native project.
Upgrade expo version to 31.exporecently launched single-SDK builds for Android. These builds contain only the SDK version the app uses when built and are both faster and slimmer. it helps for smaller standalone app build size. release note
Vote over here so that expo can look into the feature https://expo.canny.io/feature-requests/p/reducing-app-size Problem is react-native uses hermes so the packaging is similar to what native android app from android studio can do but since herme is like latest about 1-2year expo team has not made the support for hermes please vote.. And I also totally agree with #jakobinn

React Native and Facebook SDK on Android

I can't seem to get React Native FBSDK work on Android. I completed all the steps from registering the app to configuring the manifest file (can be found on this page: https://developers.facebook.com/docs/react-native/configure-android-current)
When I run the app I get the error: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first. I am using the latest version of react-native-fbsdk so the method above is deprecated. Also if I put the call into the main application class, the app crashes on startup.
So I'm kind of stuck here. Everything runs smooth on iOS but Android gives me headaches.
As you haven't shown code it's hard to know, but make sure you have:
#Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(getApplicationContext());
// If you want to use AppEventsLogger to log events:
AppEventsLogger.activateApp(this);
SoLoader.init(this, /* native exopackage */ false);
}
in your MainApplication class (MainApplication.java)--at least, I didn't see that mentioned in the link you provided. Good luck
I have the same issue and I realize that I have to complete all steps to configure the native facebook sdk for android. Its mean you need to have a facebook account for this work.
What you need to do next is:
In your project open yourapp/android/build.gradle
Add the Maven Central Repository to build.gradle before dependencies:
repositories {
mavenCentral()
}
Add compile 'com.facebook.android:facebook-android-sdk:[4,5)'to your build.gradle dependencies
Build project
Open your strings.xml file, for example: /app/src/main/res/values/strings.xml.and add <string name="facebook_app_id">xxxxxxxxx</string>
Open your AndroidManifest.xml and add <uses-permission android:name="android.permission.INTERNET"/>
Add meta to application element <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
Generate a development key hash
You can see detail in quick start of developer facebook page (developers.facebook.com/quickstarts)

Where does React-Native AsyncStorage save data on disk using iPhone Simulator?

Using IOS Simulator, where does React-Native AsyncStorage save the data on disk ?
I am using IOS Simulator version 10.0 and running IOS 10.2 and react-native 0.40.0
React Native async storage data is inside Documents folder of you application sandbox. For react-native 0.40.0 it is Documents/RCTAsyncLocalStorage_V1/manifest.json.
Path to sandbox folder for iOS Simulator (Xcode 8.2) is: ~/Library/Developer/CoreSimulator/Devices/{DEVICE_ID}/data/Containers/Data/Application/{APP_ID}
To find DEVICE_ID you can use xcrun simctl list from terminal.
Since your application gets new APP_ID on each run, you can't easily find it. I simple list all files inside Application and get most recently updated. See Xcode 6 keeps renaming my app's directory in iOS8 simulator after each run. and related for other solutions.
Based on the other helpful comments and answers, let me summarize how to inspect AsyncStorage:
First, cd into the Async directory.
cd `xcrun simctl get_app_container booted $BUNDLE_ID data`/Documents/RCTAsyncLocalStorage_V1
Then review the manifest:
jq < manifest.json
Then to pretty-print a non-null value in the manifest:
jq '."somekey"|fromjson' < manifest.json
For null values, find the file that has the value:
md5 -s "otherkey"
# 90f5ba064f8280d4c94b1f0b1a85a79e
Then pretty-print that file:
jq < 90f5ba064f8280d4c94b1f0b1a85a79e
I have also shared this in a gist

IBM Worklight - AppCenter app missing Plugin 'com.ibm.mobile.InstallerPlugin'

I'm having the same problem as this user. I've built the IBM Worklight AppCenter client application using eclipse (AppCenter -> Run As -> Build All Environments) opened it in xcode (iphone -> Run As -> Xcode project) and run the app in the iphone emulator via xcode.
After I enter my Worklight server credentials in the app (username, password, server, port, context) a "Loading" message is displayed and the app ceases functioning.
I've debugged through the app's javascript and traced the problem to the app trying to execute a call to a Cordova native plugin:
cordova.exec(pSuccessCallback, // Success callback from the plugin
function(e){
console.log("Error connecting to server [code, msg, status] = "
+ e.errorCode + ", "
+ e.errorMsg + ", "
+ e.httpCode);
pFailureCallback(e);
},
'com.ibm.mobile.InstallerPlugin', // Tell cordova to run "com.ibm.mobile.InstallerPlugin" Plugin
'updateConnection', // Tell plugin, which action we want to perform
[pUsername, pPassword, pServerURL]); // Passing list of args to the plugin
This error message is displayed in xcode: IBMAppCenter[2315:70b] ERROR: Method 'updateConnection:' not defined in Plugin 'com.ibm.mobile.InstallerPlugin'
The native libraries implementing this plugin are in their expected locations but don't appear to seen by the application - IBMAppCenter/apps/AppCenter/iphone/native/appCenterLib:
Debug-iphoneos/libAppCenterInstallerLib.a
Release-iphoneos/libAppCenterInstallerLib.a
Debug-iphonesimulator/libAppCenterInstallerLib.a
Release-iphonesimulator/libAppCenterInstallerLib.a
Are there any additional steps required to include the native libraries in the application?
Any help would be greatly appreciated.
The method "updateConnection" is defined in the InstallerPlugin. I think it is simply the first method to be called of the InstallerPlugin, hence the problem might be that you accidentally removed the installer plugin.
The directory IBMAppCenter/apps/AppCenter/iphone/native/appCenterLib must contain the different versions of libAppCenterInstallerLib.a:
Debug-iphoneos/libAppCenterInstallerLib.a
Release-iphoneos/libAppCenterInstallerLib.a
Debug-iphonesimulator/libAppCenterInstallerLib.a
Release-iphonesimulator/libAppCenterInstallerLib.a
The method updateConnection is contained in libAppCenterInstallerLib.a.
If those libs are missing, you can copy them from the original installation directory of IBM Worklight.
Please never delete the native directories of IBMAppCenter/apps/AppCenter before regenerating the iphone or Android environment. If you delete the native directories, you delete those required libraries, and then the AppCenter client is not functional.
I managed to fix this by upgrading to Worklight 6.1.
In recent versions of Cordova, the Plugin method signature has changed.
Verify this by extracting the libAppCenterInstallerlib.a with:
ar -x libAppCenterInstallerlib.a
then run:
nm IBMAppCenterPlugin.o
look for the initInfo or updateConnection methods. If they have :withDict in the method signature, then this is deprecated in recent versions of Cordova.
Using the AppCenter project from Worklight 6.1, I no longer see this issue.

Getting error while packaging the code for ipad device using flashbuilder

This is vengatesh. I am developing mobile application for android devices and apple ipad, using flashbuilder 4.5 premium.After the completion of code , I can easily create apk file for android devices but I couldn't be able to create ipa file for APPLE devices.While packaging , I got some java exception error like
"Exception in threa "main" java.lang.NullPointerException"
Please guide me on this issue . I am in urgency to complete my project for ipad devices
i used the my indexedarray as
for( var j:int = 0; j<controlsXML.length(); j++)
{
if(sectionXML[i].#Name == controlsXML[j].#SectionName)
{
indexedArray.push({controlName:controlsXML[j].#Name,Horder:controlsXML[j].#HOrder,Vorder:controlsXML[j].#VOrder});
}
}
indexedArray.sortOn(["Horder","Vorder"],[Array.NUMERIC,Array.NUMERIC]);
Try these links will helpful for you:
http://va.lent.in/blog/2011/03/25/air2-6-app-for-ios/
http://www.adobe.com/devnet/air/articles/packaging-air-apps-android.html
http://tv.adobe.com/.../build-your-first-mobile-application-in-flash-builder-45/
http://help.adobe.com/en_US/as3/iphone/WS789ea67d3e73a8b2-48bca492124b39ac5e2-7ffb.html
http://help.adobe.com/en_US/air/build/WSfffb011ac560372f2fea1812938a6e463-8000.html
http://www.riagora.com/2010/12/tips-for-flex-mobile-apps/
http://www.adobe.com/devnet/flex/articles/mobile_development_hero_burrito.html
http://tv.adobe.com/watch/adc-presents/flex-mobile-part-2-navigation-and-lists/
http://www.yeahbutisitflash.com/?p=986
http://www.instructables.com/id/How-to-use-Adobes-iPhone-Packager-without-an-Appl/
Are you following all the steps of packaging correctly?