java - 使用 ionic 构建 PhoneGap 应用程序时出现构建错误

标签 java android angularjs cordova ant

我需要使用 angularjs 构建一个phonegap应用程序。所以我选择ionic框架。这些是我到目前为止已经完成的步骤。

1.设置java、ant、adt及其路径。 2.使用命令安装ionic

npm install -g ionic

3.使用启动 ionic 项目

ionic ionic start ex1

4.新增 ionic 平台

ionic platform add android

5.使用命令构建

ionic build android

但是在构建时,它显示错误。

BUILD FAILED
C:\Android\adt-bundle\sdk\tools\ant\build.xml:932: The following error occurred
while executing this line:
C:\Android\adt-bundle\sdk\tools\ant\build.xml:950: null returned: -1073741819

Total time: 11 seconds

C:\Android\fresh\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\Android\fresh\pla
tforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen

我还没有修改任何代码。 apache ant 和 java 也可以工作。为什么会出现这个错误?

下面添加C:\Android\adt-bundle\sdk\tools\ant\build.xml中的内容

line 930  <target name="-package-resources" depends="-crunch">
                <!-- only package resources if *not* a library project -->
line 932    <do-only-if-not-library elseText="Library project: do not package resources..." >
              <aapt executable="${aapt}"
                    command="package"
                    versioncode="${version.code}"
                    versionname="${version.name}"
                    debug="${build.is.packaging.debug}"
                    manifest="${out.manifest.abs.file}"
                    assets="${asset.absolute.dir}"
                    androidjar="${project.target.android.jar}"
                    apkfolder="${out.absolute.dir}"
                    nocrunch="${build.packaging.nocrunch}"
                    resourcefilename="${resource.package.file.name}"
                    resourcefilter="${aapt.resource.filter}"
                    libraryResFolderPathRefid="project.library.res.folder.path"
                    libraryPackagesRefid="project.library.packages"
                    libraryRFileRefid="project.library.bin.r.file.path"
                    previousBuildType="${build.last.target}"
                    buildType="${build.target}"
line 950            ignoreAssets="${aapt.ignore.assets}">
                <res path="${out.res.absolute.dir}" />
                <res path="${resource.absolute.dir}" />
                <!-- <nocompress /> forces no compression on any files in assets or res/raw -->
                <!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
            </aapt>
        </do-only-if-not-library>
    </target>

最佳答案

错误-1073741819是由于Windows用户的sdk中的aapt.exe文件build-tools中的错误所致。

用此文件 https://android.googlecode.com/issues/attachment?aid=776290120000&name=aapt.exe.zip&token=ABZ6GAcRj6lR-sOmUyVguB0Gmf_BI4Z7Gg%3A1415016896298 替换 aapt.exe 文件

了解更多信息,请查看此页面

https://code.google.com/p/android/issues/detail?id=77629

关于java - 使用 ionic 构建 PhoneGap 应用程序时出现构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26711355/

相关文章:

java - 为什么空引用打印为 "null"

Android Firebase - "onDataChange"和 "onCancelled"没有被调用没有互联网连接

javascript - 如何获取函数返回结果?

javascript - 服务解决 promise 后更新 View

java - 当我使用 IntelliJ 构建代码时出现错误

java - 将传递依赖行为与 xml-apis 混淆

java - 创建一个以元组为键的哈希表

java - Android LaunchActivity 错误

android - 如何从 Widget 传递数据并打开 Activity? [安卓]

javascript - 如何在更新数据库记录时使用 $watch 查看更改