gpt4 book ai didi

android - 尝试将 NewRelic 库添加到我的应用程序时出错

转载 作者:太空狗 更新时间:2023-10-29 14:14:25 24 4
gpt4 key购买 nike

我正在尝试将 NewRelic 库包含到我的项目中,但是在构建它时出现此错误

Error:Execution failed for task ':v1:preDexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files\Android\android-studio\sdk\build-tools\19.1.0\dx.bat --dex --output
C:\Documents and Settings\t.hart\My Documents\Android\MoneyTracker\v1\build\pre-dexed\debug\android-agent-3.378.0-27125f93a249f513379e837d75ebec255f6dcaa4.jar
C:\Documents and Settings\t.hart\.gradle\caches\modules-2\files-2.1\com.newrelic.agent.android\android-agent\3.378.0\1ebf0e20081a7f1b9a5c31bfc4e7dba776e0c171\android-agent-3.378.0.jar
Error Code:
1
Output:
Error opening zip file or JAR manifest missing : C:\Documents

要包含库,您需要在 build.gradle 文件中添加 3 行,

//This to the buildscript dependancies
classpath 'com.newrelic.agent.android:agent-gradle-plugin:3.378.0'

//This line (in the example it's under the android line
apply plugin: 'newrelic'

//And this to dependancies
compile 'com.newrelic.agent.android:android-agent:3.378.0'

经过一些试验和错误后,似乎是最后一行(编译行)导致抛出错误。这是因为 C:/Documents And Settings 中的空格吗?

我也在使用这些库,它们都下载到 build/pre-dexed/debug 文件夹中,没有任何问题。

compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.android.support:gridlayout-v7:19.1.0'
compile 'com.android.support:support-v4:19.1.0'

编辑:更新错误信息

Error:Execution failed for task ':v1:preDexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files\Android\android-studio\sdk\build-tools\19.1.0\dx.bat --dex --output
C:\MoneyTracker\v1\build\pre-dexed\debug\support-v4-19.1.0-cd41ef807caadb29c9df0131dee869d3723185ad.jar
C:\Program Files\Android\android-studio\sdk\extras\android\m2repository\com\android\support\support-v4\19.1.0\support-v4-19.1.0.jar
Error Code:
1
Output:
Error opening zip file or JAR manifest missing : C:\Documents

这是一个奇怪的错误...

最佳答案

它实际上与文件夹名称中的空格有关,错误消息告诉您 gradle 在 C:\Documents 中找不到 zip 或 jar list ,这显然不是您的 newrelic 库所在的文件夹。尝试移动您的项目在名称没有空格的目录中。养成习惯,有些工具真的不喜欢文件名中的空格(尤其是 unix root 的工具)。

关于android - 尝试将 NewRelic 库添加到我的应用程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23892478/

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