DX Application Performance Management

 View Only
  • 1.  AXA Android: How can I install the wrapped application on Android or integrate it with Gradle?

    Posted Jun 07, 2021 12:07 PM
    I have done the wrapping of the application from the web, but when I try to install on the cell phone, I get a message that tells me that it has not been possible. It should be noted that the cell phone is configured to install the programs from the APKs.
    I also tried to integrate the AXA SDK with the Gradel following the instructions on the web page, but it gives me errors, since it does not recognize the modifications that I make.

    AXA Gradel

    Note: The links for the documentation on the web are still pointing to the old documentation.


  • 2.  RE: AXA Android: How can I install the wrapped application on Android or integrate it with Gradle?

    Broadcom Employee
    Posted Jun 08, 2021 02:14 AM
    HI Carlos, 

    It would be very helpful to see the actual error message.

    To see the error, and to have more configuration options, you could try to use the Command Line option, meaning download the wrapper utility to a local machine. Our wrapping tool uses an open source tool called apktool. This tool reverse engineers the binary Android package, and instruments methods in it based on regex rules in .. \emm\conf\Android.xml or android-cordova.xml file.
    It will also attempt to check and modify the AndroidManifest.xml to add required permissions, so maybe this failed, and hence wrapping went wrong...to avoid this, use flag -r with the command line wrapper. Also use -v to see all the error messages

    You need the following permissions in the AndroidManifest.xml, or else the data collection will fail. 

    Required Permissions in AndroidManifest.xm

    Mandatory

    • <uses-permission android:name="android.permission.INTERNET" />
    • <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


    Optional but recommended(if these permissions are not specified the SDK will not capture the corresponding events/matrix)

    • <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    • <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> // or ACCESS_FINE_LOCATION"


    Of course, the SDK will not capture any location info  or Wifi related stuffs, if the optional permissions are not there in the manifest. Also we might notice some exception stack trace like "WifiService: Neither user 10193 nor current process has android.permission.ACCESS_WIFI_STATE." if the ACCESS_WIFI_STATE permission is not given to the application, but this will not affect any functionality

    Manual wrapping on Linux, OS X and Windows

    You can also use the wrapper manually on Linux, macosx and windows with the following steps (Windows). Replace apk, plist and wrapper utility name with the ones that use use:

    1. Unzip the CAMobileAppAnalytics-wrapper.zip to c:\AXA
    2. set CA_EMM_HOME=c:\AXA\emm
    3. Run the following command (replace your apk and plist file names)

    java -jar ca-maa-android-sdk-wrapper-<version>.jar –verbose -apk "app-debug.apk" -plist "app_camdo.plist" -rules AUTO_DETECT -signconfig emm/conf/jarsigner.properties -disablejsinterception "false" -buildtype "release" -nores "release"

    NOTE: We use 32-bit zipalign - binary with the wrapper.  Some customers need a 64-bit one. If this is required, download and replace the default one in the wrapper ../emm/bin/android/linux -folder 




  • 3.  RE: AXA Android: How can I install the wrapped application on Android or integrate it with Gradle?

    Broadcom Employee
    Posted Jun 08, 2021 04:40 AM
    Hello again, 

    Depending on the error message, it also may be that you haven't signed the apk with your own key...self-certificate is not valid with most apks when you install them on an actual handset

    thanks


  • 4.  RE: AXA Android: How can I install the wrapped application on Android or integrate it with Gradle?

    Posted Jun 08, 2021 12:49 PM
      |   view attached
    Janne,
    Thank you for the information.
    The error is:

    Attachment(s)

    log
    wrapped.log   20 KB 1 version


  • 5.  RE: AXA Android: How can I install the wrapped application on Android or integrate it with Gradle?

    Broadcom Employee
    Posted Jun 09, 2021 01:50 AM
    Hello Carlos

    OK, your apk is not signed with a security certificate. This step is mentioned in the instructions for the online wrapping:

    Using Online Wrapper

    Follow these steps to integrate your Android

    1. Upload your App's apk file ( Optional: select  to ignore resources and then upload your app's apk file )
    2. Download the wrapped apk
    3. Sign the wrapped apk with your certificate

    If you do not have an enterprise certificate from your company, for testing you can probably generate your own, as long as you have JDK installed on a linux/windows box. Then you also need the jarsigner and zipaling tools:

    keytool in /java/bin   jarsigner and zipaling in Android build-tools

    1. keytool -genkey -v -keystore debug.keystore -alias android -keyalg RSA -keysize 2048 -validity 20000

    2. jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore debug.keystore yourapkalign.apk android

    3. zipalign -v 4 yourapk.apk yourapkalign.apk

    4. adb install apk

    If there are errors such as jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size', try renaming the apk to zip, and then open up, remove the META-INF -folder, rename to apk  again and try. Take a backup of the original first

    Make sure JAVA_HOME is set so that jarsigner can be found




  • 6.  RE: AXA Android: How can I install the wrapped application on Android or integrate it with Gradle?

    Posted Jun 09, 2021 06:21 PM
    Hello Janne,
    Using apksigner.jar it is working:

    java -jar build-tools\30.0.3\lib\apksigner.jar sign -v --out app_align_sign.apk --ks debug.keystore --ks-key-alias android app_align.apk