ANT因图书馆计划失败(ActionBarSherlock,HoloEverywhere)

时间:2012-08-11 06:34:52

标签: android ant build actionbarsherlock library-project

昨天我能够解决以前的所有问题,简单的Android应用程序运行没有任何问题。

为他们设置好所有内容后,我尝试为我的3个更复杂的应用做同样的事情。所有这些应用程序都使用ActionBarSherlock和ViewPagerIndicator。

第一个问题是如果我有一个项目(没有holoeverywhere),ant就无法编译,因为它试图添加一个已经添加的类。我知道哪个库导致了这个问题 - > android-support-v4.jar但我无法删除它。它是ViewPagerIndicator和ActionBarSherlock所必需的。

第二个更烦人的问题是,只要我添加HoloEverywhere(它需要ActionBarSherlock作为依赖项),它就会给我以下错误:

[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [aapt] /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/res/values/styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock'.
     [aapt] /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/res/values/styles.xml:6: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock'.
     [aapt] /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/res/values-v14/styles.xml:12: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock'.
     [aapt] /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/res/values/styles.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light'.
     [aapt] /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/res/values-v14/styles.xml:14: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light'.
     [aapt] /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/res/values/styles.xml:46: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light.DarkActionBar'.
     [aapt] /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/res/values/styles.xml:66: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.ForceOverflow'.
     [aapt] /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/res/values/styles.xml:86: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light.ForceOverflow'.
     [aapt] /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/res/values/styles.xml:106: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light.DarkActionBar.ForceOverflow'.

我知道它说缺少对ActionBarSherlock样式的引用,但为什么呢?我使用原始的ant-script,即使我能够修复库的所有路径(ant忽略了库项目的build.xml中定义的project.properties),它也无法构建。

任何提示或想法?

以上所有内容似乎都可以。

Buildfile: /Users/**/Zuzzle/build.xml

-set-mode-check:

-set-release-mode:

-release-obfuscation-check:
     [echo] proguard.config is ${proguard.config}

-check-env:
 [checkenv] Android SDK Tools Revision 20
 [checkenv] Installed at /Entwicklung/android-sdk

-setup:
     [echo] Project Name: SplashscreenActivity
  [gettype] Project Type: Application
     [echo] Switching between debug and non debug build: Deleting previous compilation output...
   [delete] Deleting directory /Users/**/Zuzzle/bin/classes

-build-setup:
     [echo] Resolving Build Target for SplashscreenActivity...
[gettarget] Project Target:   Android 4.1
[gettarget] API level:        16
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /Users/**/Zuzzle/bin/classes
     [echo] ----------
     [echo] Resolving Dependencies for SplashscreenActivity...
[dependency] Library dependencies:
[dependency] 
[dependency] ------------------
[dependency] Ordered libraries:
[dependency] 
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.
     [echo] ----------
     [echo] Building Libraries with 'release'...

nodeps:

-set-mode-check:

-set-release-mode:

-release-obfuscation-check:
     [echo] proguard.config is ${proguard.config}

-check-env:
 [checkenv] Android SDK Tools Revision 20
 [checkenv] Installed at /Entwicklung/android-sdk

-setup:
     [echo] Project Name: library
  [gettype] Project Type: Android Library
     [echo] Switching between debug and non debug build: Deleting previous compilation output...
   [delete] Deleting directory /Users/**/Project Librarys/Android-ViewPagerIndicator/library/bin/classes

-build-setup:
     [echo] Resolving Build Target for library...
[gettarget] Project Target:   Android 4.1
[gettarget] API level:        16
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /Users/**/Project Librarys/Android-ViewPagerIndicator/library/bin/classes
     [echo] ----------
     [echo] Resolving Dependencies for library...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.

-pre-build:

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.

-pre-compile:

-compile:
    [javac] Compiling 8 source files to /Users/**/Project Librarys/Android-ViewPagerIndicator/library/bin/classes
     [echo] Creating library output jar file...
      [jar] Building jar: /Users/**/Project Librarys/Android-ViewPagerIndicator/library/bin/classes.jar

-post-compile:

-obfuscate:

-dex:
     [echo] Library project: do not convert bytecode...

-crunch:
   [crunch] Crunching PNG Files in source dir: /Users/**/Project Librarys/Android-ViewPagerIndicator/library/res
   [crunch] To destination dir: /Users/**/Project Librarys/Android-ViewPagerIndicator/library/bin/res
   [crunch] Crunched 0 PNG files to update cache

-package-resources:
     [echo] Library project: do not package resources...

-package:
     [echo] Library project: do not package apk...

-post-package:

-release-prompt-for-password:

-release-nosign:
     [echo] 
[propertyfile] Updating property file: /Users/**/Project Librarys/Android-ViewPagerIndicator/library/bin/build.prop
[propertyfile] Updating property file: /Users/**/Project Librarys/Android-ViewPagerIndicator/library/bin/build.prop
[propertyfile] Updating property file: /Users/**/Project Librarys/Android-ViewPagerIndicator/library/bin/build.prop
[propertyfile] Updating property file: /Users/**/Project Librarys/Android-ViewPagerIndicator/library/bin/build.prop

-release-sign:

-post-build:

release:

nodeps:

-set-mode-check:

-set-release-mode:

-release-obfuscation-check:
     [echo] proguard.config is ${proguard.config}

-check-env:
 [checkenv] Android SDK Tools Revision 20
 [checkenv] Installed at /Entwicklung/android-sdk

-setup:
     [echo] Project Name: library
  [gettype] Project Type: Android Library
     [echo] Switching between debug and non debug build: Deleting previous compilation output...
   [delete] Deleting directory /Users/**/Project Librarys/ActionBarSherlock/library/bin/classes

-build-setup:
     [echo] Resolving Build Target for library...
[gettarget] Project Target:   Android 4.1
[gettarget] API level:        16
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /Users/**/Project Librarys/ActionBarSherlock/library/bin/classes
     [echo] ----------
     [echo] Resolving Dependencies for library...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.

-pre-build:

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.

-pre-compile:

-compile:
    [javac] Compiling 82 source files to /Users/**/Project Librarys/ActionBarSherlock/library/bin/classes
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
     [echo] Creating library output jar file...
      [jar] Building jar: /Users/**/Project Librarys/ActionBarSherlock/library/bin/classes.jar

-post-compile:

-obfuscate:

-dex:
     [echo] Library project: do not convert bytecode...

-crunch:
   [crunch] Crunching PNG Files in source dir: /Users/**/Project Librarys/ActionBarSherlock/library/res
   [crunch] To destination dir: /Users/**/Project Librarys/ActionBarSherlock/library/bin/res
   [crunch] Crunched 0 PNG files to update cache

-package-resources:
     [echo] Library project: do not package resources...

-package:
     [echo] Library project: do not package apk...

-post-package:

-release-prompt-for-password:

-release-nosign:
     [echo] 
[propertyfile] Updating property file: /Users/**/Project Librarys/ActionBarSherlock/library/bin/build.prop
[propertyfile] Updating property file: /Users/**/Project Librarys/ActionBarSherlock/library/bin/build.prop
[propertyfile] Updating property file: /Users/**/Project Librarys/ActionBarSherlock/library/bin/build.prop
[propertyfile] Updating property file: /Users/**/Project Librarys/ActionBarSherlock/library/bin/build.prop

-release-sign:

-post-build:

release:

nodeps:

-set-mode-check:

-set-release-mode:

-release-obfuscation-check:
     [echo] proguard.config is ${proguard.config}

-check-env:
 [checkenv] Android SDK Tools Revision 20
 [checkenv] Installed at /Entwicklung/android-sdk

-setup:
     [echo] Project Name: library
  [gettype] Project Type: Android Library
     [echo] Switching between debug and non debug build: Deleting previous compilation output...
   [delete] Deleting directory /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/bin/classes

-build-setup:
     [echo] Resolving Build Target for library...
[gettarget] Project Target:   Android 4.1
[gettarget] API level:        16
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /Users/**/Project Librarys/HoloEverywhere/HoloEverywhereLib/bin/classes
     [echo] ----------
     [echo] Resolving Dependencies for library...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.

-pre-build:

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...

路径中的**只是隐藏真实路径。脚本知道正确的路径。

1 个答案:

答案 0 :(得分:1)

我现在能够解决我的问题。似乎我的build.xml已损坏并且它出现了任何问题。

如果有人想重命名他的应用程序包,这里是我在网络上找到的解决方案:

<target name="-package-resources" depends="-crunch">
        <!-- only package resources if *not* a library project -->
        <do-only-if-not-library elseText="Library project: do not package resources..." >
            <aapt executable="${aapt}"
                    command="package"
                    versioncode="${package.manifest.version.code}"
                    versionname="${package.manifest.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"
                    previousBuildType="${build.last.target}"
                    buildType="${build.target}"
                    ignoreAssets="${aapt.ignore.assets}"
                    manifestpackage="${package.manifest.name}">
                <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>

这是我认为最干净的变体。