gpt4 book ai didi

android - 如何在没有 Eclipse 的情况下将 JAR 包含在 APK 中?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:53:32 24 4
gpt4 key购买 nike

我维护一个 Android 应用程序,但没有使用 Eclipse。我没有使用 Eclipse。我正在使用 antbuild.xml 以及 build.properties

我已将 .jar 文件放入 libs/目录中。我的代码编译得很好。但是当我在模拟器上运行它时,输出的 APK 不包含 .jar,所以我得到一个运行时堆栈跟踪:

ERROR/AndroidRuntime(470): java.lang.NoClassDefFoundError: com.google.ads.AdView

我的 build.properties 看起来像这样:

jar.libs.dir=libs

libs/目录包含我的 .jar 文件。

build.xml 中需要包含哪些内容才能将外部 .jar 文件包含在 APK 中?

编辑:理论上这个答案应该有效,但它不适合我。它过时了吗?是什么赋予了? How to add external jar libraries to an android project from the command line

最佳答案

我刚遇到一个类似的问题,注意到库不应该放在“myprojectdir\lib”中。当我将它们移动到“myprojectdir\libs”时,一切都开始工作了。

关于android - 如何在没有 Eclipse 的情况下将 JAR 包含在 APK 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6801445/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com