2012-08-11 182 views
0

昨天我能夠解決我以前的所有問題,簡單的android應用程序運行沒有任何問題。ANT圖書館項目失敗(ActionBarSherlock,HoloEverywhere)

爲他們設置了一切後,我試圖爲我的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腳本,即使我能夠修復庫的所有路徑(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... 

**中的路徑只能隱藏真實的路徑。腳本知道正確的路徑。

+0

「我知道哪個庫導致了問題 - > android-support-v4.jar,但我無法刪除它,它是ViewPagerIndicator和ActionBarSherlock所必需的。」 - 其中一方或雙方都有自己的副本;你自己並不需要一個。但是,由於您決定不發佈實際錯誤(相反,發佈其他隨機輸出**而不顯示錯誤),因此很難給出更具體的建議。 「ant忽略庫項目的build.xml中定義的project.properties」 - 它適用於我。 – CommonsWare 2012-08-19 00:02:32

+0

什麼適合你?那螞蟻會忽略相同的庫?你有什麼想法爲什麼螞蟻腳本不構建應用程序?我真的appraciate任何幫助 – mikepenz 2012-08-19 17:32:57

+0

「什麼對我有用?」 - Ant關注庫項目的'project.properties',關注它們的庫項目依賴關係。 – CommonsWare 2012-08-19 17:36:44

回答

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> 

這是最乾淨的變種,我認爲。

+1

添加libraryRFileRefid =「project.library.bin.r.file.path」,這將使這完美。 – 2014-04-25 14:31:13

+0

感謝您的答案。我現在使用gradle。 – mikepenz 2014-04-25 18:05:37

+1

其實你的答案幫助我,我沒有試圖回答。 – 2014-04-28 10:02:50