DX Application Performance Management

Expand all | Collapse all

Wrapping apk error

Jump to Best Answer
  • 1.  Wrapping apk error

    Posted 10-29-2015 11:13 AM


    I'm trying to wrap an apk from command line (because from MAA site it's not working) and I have an error.

    I don't have source code, only the apk; can you help me to understand it?




    This is the command output


    [root@centosVM2 x]# ./wrap.sh -a TEST_1.0.apk -p Test_camdo.plist

    checking for /usr/java/latest//bin/jarsigner ...

    checking for TEST_1.0.apk ...

    checking for Test_camdo.plist ...

    checking for emm/conf/mdo.keystore ...


    Using JAVA_HOME=/usr/java/latest/

    APK File: TEST_1.0.apk

    Plist: Test_camdo.plist

    Keystore: emm/conf/mdo.keystore

    Wrapper: ca-maa-android-sdk-wrapper-15.2.jar

    Certificate Password: *******

    Keystore Password: *******

    Alias: mdo

    /usr/java/latest//bin/java -jar ca-maa-android-sdk-wrapper-15.2.jar -apk TEST_1.0.apk -plist Test_camdo.plist -rules emm/conf/android.xml -keystore emm/conf/mdo.keystore -storepass mobiledevops -keypass mobiledevops -buildtype release -alias mdo

    Step 1 of 4: Extracting Target APK: TEST_1.0.apk

    Step 2 of 4: Instrumenting ......

    Step 3 of 4: Packaging instrumented APK.

    ^[[6~^[[6~/tmp/AndroidWrapper_91710625057882541408517645720855___5489337/apktoolExtract/res/values-v23/styles.xml:5: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/AlertDialog'.



    /tmp/AndroidWrapper_91710625057882541408517645720855___5489337/apktoolExtract/res/values-v23/styles.xml:6: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/DialogWindowTitle'.



    Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9063816268722799167.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 23, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL5006536585363267431.tmp, -0, arsc, -I, /root/apktool/framework/1.apk, -S, /tmp/AndroidWrapper_91710625057882541408517645720855___5489337/apktoolExtract/res, -M, /tmp/AndroidWrapper_91710625057882541408517645720855___5489337/apktoolExtract/AndroidManifest.xml]

      at brut.androlib.Androlib.buildResourcesFull(Androlib.java:442)

      at brut.androlib.Androlib.buildResources(Androlib.java:379)

      at brut.androlib.Androlib.build(Androlib.java:282)

      at brut.androlib.Androlib.build(Androlib.java:255)

      at brut.apktool.Main.cmdBuild(Main.java:225)

      at brut.apktool.Main.main(Main.java:84)

    Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9063816268722799167.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 23, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL5006536585363267431.tmp, -0, arsc, -I, /root/apktool/framework/1.apk, -S, /tmp/AndroidWrapper_91710625057882541408517645720855___5489337/apktoolExtract/res, -M, /tmp/AndroidWrapper_91710625057882541408517645720855___5489337/apktoolExtract/AndroidManifest.xml]

      at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:504)

      at brut.androlib.Androlib.buildResourcesFull(Androlib.java:428)

      ... 5 more

    Caused by: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9063816268722799167.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 23, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL5006536585363267431.tmp, -0, arsc, -I, /root/apktool/framework/1.apk, -S, /tmp/AndroidWrapper_91710625057882541408517645720855___5489337/apktoolExtract/res, -M, /tmp/AndroidWrapper_91710625057882541408517645720855___5489337/apktoolExtract/AndroidManifest.xml]

      at brut.util.OS.exec(OS.java:90)

      at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:498)

      ... 6 more

    Step 4 of 4: Signing APK with dummy certificate.

    jarsigner: unable to open jar file: /tmp/AndroidWrapper_91710625057882541408517645720855___5489337/manifest_modded_TEST_1.0.apk

    ERROR: jar signing failed...

    ERROR: Exiting, Signing APK failed!

    Exception: Exiting, Signing APK failed!

    java.lang.Exception: Exiting, Signing APK failed!

      at com.ca.android.wrapper.Wrapper.startWrapping(Wrapper.java:181)

      at com.ca.android.wrapper.Wrapper.doWrap(Wrapper.java:62)

      at com.ca.android.wrapper.Wrapper.doWrap(Wrapper.java:36)

      at com.ca.android.wrapper.CAAPKWrapper.runWrapper(CAAPKWrapper.java:165)

      at com.ca.android.wrapper.CAAPKWrapper.main(CAAPKWrapper.java:156)

    Total time: 111 secs

  • 2.  Re: Wrapping apk error
    Best Answer

    Broadcom Employee
    Posted 10-29-2015 11:38 AM



    I suspect I know the issue and the good news is that there is an easy solution


    can you try running


    ./wrap.sh -a TEST_1.0.apk -p Test_camdo.plist -r

    If this resolves the issue then the issue is explained in TEC1769195

    If you still have the issue then run


    sudo yum install zlib.i686

    sudo yum install libstdc++.i686


    If this resolves the issue then you did not have all the pre-reqs installed.




  • 3.  Re: Wrapping apk error

    Posted 10-29-2015 11:45 AM

    Thanks Richard,

    it worked, i have produced the 'wrapped' version ... unfortunately the result is not working on my phone; when i launch it my android phone says: "Unfortunately, TEST has stopped"

    I'll try to attach the phone to adb debug to try to understand the problem.

  • 4.  Re: Wrapping apk error

    Posted 11-06-2015 04:00 AM


    I've attached to a debug the wrapped application and when it start I get this error:


    11-06 09:40:58.025: E/AndroidRuntime(26201): java.lang.VerifyError: Verifier rejected class mono.android.app.Application due to bad method void mono.android.app.Application.<init>() (declaration of 'mono.android.app.Application' appears in /data/app/it.cs.csidm-1/base.apk)


    It was developed with Xamarin .. any hope to get it works?



  • 5.  Re: Wrapping apk error

    Posted 11-06-2015 09:33 AM

    Please attach unwrapped APK.  We don't support Xamarin but we will take a quick look on what's going on.

  • 6.  Re: Wrapping apk error

    Posted 11-06-2015 10:05 AM
      |   view attached


    here is the original apk; any help is welcome




    CSIDM_1.0.apk.zip   9.76 MB 1 version

  • 7.  Re: Wrapping apk error

    Broadcom Employee
    Posted 11-09-2015 05:05 AM

    HI Daniella


    we can see that the manifest is missing the permissions documented in TEC1769195. As you had toi use the -r switch to wrap the apk we could not add the permissions. Please either add these to your manifest or correct the issue in the manifest so that -r is not required.


    If you still have the issue after this please upload the new apk without the debug. We do not have a full xamarin env as it is not officially supported and thus cannot run the debug version.



  • 8.  Re: Wrapping apk error

    Posted 11-09-2015 05:32 AM

    Hi Richard,

    thanks for you help.

    I'm not sure to understand what you're saying, the apk version I've attached is the original one (the same you will get from Play Store).

    I was successful in wrapping the apk with "-r" option but the result apk is not working .. it doesn't even start; it crash soon after launch.

    Do you think the "-r" option is the cause of the failure of the wrapped apk?

    I don't have the source code and I need to ask to the developer to modify the manifest and recompile the application; do you think that adding the following permission to the manifest




    Will solve the crash of the wrapped apk?


    Thanks again

  • 9.  Re: Wrapping apk error

    Posted 11-10-2015 05:05 PM

    Hi every one,

    I have the same problem but with different applications; all the applications show a message "Unfortunately, ...... has stopped". I am doing wrap a hybrid application.