1

我在将本机 android 应用程序从设备/模拟器上传到 MTW 时遇到问题。场景是这样的:

  1. 用户使用 Android Studio 和 CLI 构建移动应用
  2. 将移动应用程序部署到模拟器或设备
  3. 测试功能,它工作正常
  4. 在eclipse中创建一个测试工作台项目
  5. 在模拟器上启动 MTW 客户端并连接到测试工作台项目
  6. 将应用程序从 Android 模拟器上传到测试工作台

正是在这一点上它失败了,我上传它时出错。它似乎又是某种对齐问题,但我不知道如何解决它。

现在,如果我上传一个混合 Android 应用程序,那么它可以工作,所以我知道我的 eclipse 环境配置正常(至少在一定程度上),因为我解决了最初的 zipalign 问题。

所以我最初的想法是

  1. 也许我需要做一些额外的配置,我不清楚
  2. 也许我正在使用的 apk 文件在某种程度上是无效的,我需要做一些特殊的事情才能上传它注意我在 build.gradle 文件中使用了 zipalign 选项。但无济于事。

    . android { compileSdkVersion 19 buildToolsVersion "19.1"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            zipAlign true
        }
    }
    

    } ...

日志显示以下内容

!ENTRY com.ibm.rational.test.lt.models.behavior.moeb 1 0 2014-08-26 21:37:08.540
!MESSAGE CRRTWM6013I from component Android-BuildChain: configuration: {cache.dir=C:\Work\Worklight_v62\Test\.metadata\.plugins\com.ibm.rational.test.lt.models.behavior.moeb\cache, android.runtime.dir=C:\IBM\WorklightStudio_v62\eclipse\eclipse\plugins\com.ibm.rational.test.mobile.android.runtime_1.2.100.v20140603_1426, ibm.jdk.install.dir=C:\Program Files\Java\jdk1.7.0_25, android.sdk.install.dir=C:\Utils\Android\android-sdk, runtime.cache.dir=C:\Work\Worklight_v62\Test\.metadata\.plugins\com.ibm.rational.test.lt.models.behavior.moeb\builds\runtimes}

!ENTRY com.ibm.cic.licensing.common.util 4 0 2014-08-26 21:37:19.161
!MESSAGE LicenseCheck returned FALSE!

!ENTRY com.ibm.rational.test.lt.models.behavior.moeb 4 0 2014-08-26 21:37:35.694
!MESSAGE CRRTWM6012E exception thrown from component Android-BuildChain while building from '0-com.example.ibmbankapp.app-1.apk'
!STACK 0
brut.androlib.AndrolibException: com.ibm.rational.test.mobile.android.buildchain.utils.ProcessExec$ProcessExecException: Cannot exec command: [C:\Utils\Android\ANDROI~1\build-tools\20.0.0\aapt.exe, p, --no-crunch, -F, C:\Users\mmalc\AppData\Local\Temp\APKTOOL6016720483897094701.tmp, -0, arsc, -I, C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\cache\apktool\framework\1.apk, -S, C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res, -M, C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\AndroidManifest.xml]
Exit code: 1
Process output stream:

Process error stream:
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:9: error: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:118: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:327: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:368: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:382: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:389: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values-v14\styles.xml:84: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:401: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base.DropDownItem'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:407: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:429: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:502: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.Base'.

    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:444)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:376)
    at brut.androlib.Androlib.buildResources(Androlib.java:320)
    at brut.androlib.Androlib.build(Androlib.java:237)
    at brut.androlib.Androlib.build(Androlib.java:203)
    at com.ibm.rational.test.mobile.android.buildchain.tools.build.BuildWrapper.build(BuildWrapper.java:213)
    at com.ibm.rational.test.mobile.android.buildchain.AndroidBuildChain.build(AndroidBuildChain.java:289)
    at com.ibm.rational.test.lt.models.behavior.moeb.utils.BuildChainManager$Build.run(BuildChainManager.java:198)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.ibm.rational.test.mobile.android.buildchain.utils.ProcessExec$ProcessExecException: Cannot exec command: [C:\Utils\Android\ANDROI~1\build-tools\20.0.0\aapt.exe, p, --no-crunch, -F, C:\Users\mmalc\AppData\Local\Temp\APKTOOL6016720483897094701.tmp, -0, arsc, -I, C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\cache\apktool\framework\1.apk, -S, C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res, -M, C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\AndroidManifest.xml]
Exit code: 1
Process output stream:

Process error stream:
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:9: error: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:118: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:327: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:368: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:382: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:389: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values-v14\styles.xml:84: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:401: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base.DropDownItem'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:407: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:429: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
C:\Work\WORKLI~4\Test\METADA~1\PLUGIN~1\COMIBM~1.MOE\builds\C2278B~1\0-com.example.ibmbankapp.app-1\res\values\styles.xml:502: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.Base'.

    at com.ibm.rational.test.mobile.android.buildchain.utils.ProcessExec.exec(ProcessExec.java:102)
    at com.ibm.rational.test.mobile.android.buildchain.utils.ProcessExec.exec(ProcessExec.java:77)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:442)
    ... 8 more

!ENTRY com.ibm.rational.test.lt.models.behavior.moeb 4 0 2014-08-26 21:37:35.704
!MESSAGE CRRTWM6010E exception thrown while building from '0-com.example.ibmbankapp.app-1.apk'
!STACK 0
java.lang.Error: Playback-ready package build/sign/align failed
    at com.ibm.rational.test.mobile.android.buildchain.AndroidBuildChain.build(AndroidBuildChain.java:290)
    at com.ibm.rational.test.lt.models.behavior.moeb.utils.BuildChainManager$Build.run(BuildChainManager.java:198)
    at java.lang.Thread.run(Unknown Source)

我正在使用 WL v6.2.0.00-20140801-1709 MTWW v 8.5.100.v20131024_1533

我也已经看过另一篇关于 zipalign 问题的帖子并且没有任何快乐,因为我没有安装 Android API 20 - 22

感谢任何指针。

4

2 回答 2

0

This issue come from the new Android SDK release 23. Google has modified the location of the zipalign tool :-(

Here is the workaround:

copy android-sdk-dir/build-tools/version/zipalign[.exe] to android-sdk-dir/tools

Dominique

于 2014-08-28T08:31:31.467 回答
0

此问题出现在最新的构建工具中。请参考这个答案: https ://stackoverflow.com/a/32517719/2633707

于 2015-10-07T10:42:41.573 回答