【问题标题】:Eclipse Android app: Run signed with real certificateEclipse Android 应用程序:使用真实证书签名运行
【发布时间】:2011-08-05 21:21:36
【问题描述】:

有没有办法让运行按钮使用真正的签名证书而不是调试证书?我想避免在安装开发副本之前从模拟器中卸载“共享用户”应用程序。

我已经知道我可以导出签名副本,但我更喜欢自动构建签名副本/在模拟器上运行

【问题讨论】:

    标签: android eclipse code-signing


    【解决方案1】:

    我假设您使用的是 Eclipse。

    首先,通过运行“android update project -p”为您的项目添加 Ant 支持。在项目目录中。

    接下来,在您的 build.xml 中创建自定义目标,如下所示(键入未测试):

    <target name="install-release" depends="release">
        <sequential>
            <echo>Installing ${out.release.file} onto default emulator or device...</echo>
            <exec executable="${adb}" failonerror="true">
                <arg line="${adb.device.arg}" />
                <arg value="install" />
                <arg value="-r" />
                <arg path="${out.release.file}" />
            </exec>
        </sequential>
    </target>
    
    <target name="run-release" depends="install-release">
        <!-- not sure what goes here -->
    </target>
    

    然后您可以在文件面板中展开 build.xml,并将 run-release 目标添加到您的工具栏。这至少可以从工具栏中进行安装。

    您需要设置适当的属性才能使签名工作(key.store、key.store.password、key.alias、key.alias.password),如Building and Running from the Command Line中所述

    希望这会有所帮助。

    【讨论】:

    • 我运行了 android update project,它创建了一个 build.xml,但依赖目标 release 没有创建,所以 install-release 失败。
    • 发布失败的原因是什么? Release是android项目的标准ant target,所以这说明项目有问题
    • 这是一个全新的 Eclipse 项目,它没有build.xml,直到我运行android update project,然后它有一个没有目标的build.xml。错误是没有目标release。错误不是来自输出,而是在我粘贴您的代码时由 Eclipse 突出显示。我确实需要将--path . 添加到android update project。也许我需要添加一些其他内容来为build.xml 提供更好的起点?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-28
    • 1970-01-01
    • 1970-01-01
    • 2019-10-11
    • 1970-01-01
    • 2014-05-16
    • 2014-03-19
    相关资源
    最近更新 更多