编译Android项目与库项目失败,缺少classes.jar [英] Compiling android project with a library project fails with missing classes.jar

查看:640
本文介绍了编译Android项目与库项目失败,缺少classes.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做这取决于Android的V7应用程序兼容性支持库的应用程序。当我试图建立与Ant的项目,我从地塞米松,指出它无法找到从应用程序兼容性项目的bin目录下的文件classes.jar错误。下面是我做了什么:

I'm making an app that depends on the Android v7 appCompat support library. When I'm trying to build the project with Ant, I get an error from dex stating that it can't find the file classes.jar from the appCompat project's bin directory. Here's what I have done:


  1. 我复制的SDK下的应用程序兼容性目录到我的项目。它现在是与库,水库,SRC等沿顶级目录中的一个。

  2. 我添加库到我的项目:

  1. I copied the appCompat directory under the SDK over to my project. It is now one of the top-level directories along with libs, res, src etc.
  2. I added the library to my project:

android update project --target 1 --path . --library .\appCompat

( - 1目标指的是API 22级我的系统上)

(--target 1 refers to api level 22 on my system.)

我产生建立的应用程序兼容性项目文件:

I generated build files for the appCompat project:

cd appCompat
android update lib-project --target 1 --path .


  • 我回到我的项目,并试图构建它:

  • I went back to my project and attempted building it:

    cd ..
    ant clean debug
    

    一切顺利,直到我得到以下几点:

    Everything goes smoothly until I get the following:

    -dex:
          [dex] input: C:\Users\Tuukka\Documents\app\bin\classes
          [dex] input: C:\Users\Tuukka\Documents\app\appcompat\bin\classes.jar
          [dex] input: C:\Users\Tuukka\Documents\app\appcompat\libs\android-support-v4.jar
          [dex] input: C:\Users\Tuukka\Documents\app\appcompat\libs\android-support-v7-appcompat.jar
          [dex] Pre-Dexing C:\Users\Tuukka\Documents\app\appcompat\libs\android-support-v4.jar -> android-support-v4-7d4b9d18b52617b1310b8c2397abe6b7.jar
          [dex] Pre-Dexing C:\Users\Tuukka\Documents\app\appcompat\libs\android-support-v7-appcompat.jar -> android-support-v7-appcompat-af2360631cde3dc57c1fde6f23204ddb.jar
          [dex] Converting compiled files and external libraries into C:\Users\Tuukka\Documents\app\bin\classes.dex...
           [dx]
           [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
           [dx] java.io.FileNotFoundException: C:\Users\Tuukka\Documents\app\appcompat\bin\classes.jar (No such file or directory)
    


  • 有确实是在应用程序兼容性\\ bin中没有classes.jar。事实上,在整个构建输出照看,似乎这样的事情从来没有建成,但蚂蚁似乎期望它的存在。

    There is indeed no classes.jar in appCompat\bin. In fact, after looking through the entire build output, it seems such a thing was never built, yet Ant seems to expect that it exists.

    有我丢失的东西吗?任何帮助将大大AP preciated。

    Is there something I'm missing here? Any help would be greatly appreciated.

    推荐答案

    我觉得这个问题是由不被设置为库项目的项目造成的。如果你正在建立由专人一切你可以通过添加解决这个问题 android.library = TRUE [项目] /appCompat/project.properties 文件。

    I think this problem is caused by the project not being set up as a library project. If you are setting up everything by hand you can fix this by adding android.library=true to the [your project]/appCompat/project.properties file.

    这篇关于编译Android项目与库项目失败,缺少classes.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆