使用ant构建Android应用程序时遇到以下异常。 无法弄清楚为什么抛出这些异常!
Execute:Java13CommandLauncher: Executing 'D:\Android-2.0\android-sdk-windows\platforms\android-1.5\tools\aapt.exe' with arguments:
'package'
'-f'
'-M'
'E:\manish_test\timetrack\client\static\android\AndroidManifest.xml'
'-S'
'E:\manish_test\timetrack\client\static\android\res'
'-A'
'E:\manish_test\timetrack\client\static\android\assets'
'-I'
'D:\Android-2.0\android-sdk-windows\platforms\android-1.5\android.jar'
'-F'
'C:\CLIENT_BUILDS\QA\3.0.9\Android\11-Feb-2010_b1\XoraTimeTrack.ap_'
可执行文件和参数周围的'
个字符是
不是命令的一部分。
[null] (skipping index file 'E:\manish_test\timetrack\client\static\android\res\drawable\Thumbs.db')
Class org.apache.tools.ant.Project loaded from parent loader (parentFirst)
Finding class com.android.sdklib.internal.project.ProjectProperties$PropertyType
Loaded from D:\Android-2.0\android-sdk-windows\tools\lib\sdklib.jar com/android/sdklib/internal/project/ProjectProperties$PropertyType.class
Class java.lang.Enum loaded from parent loader (parentFirst)
Class com.android.sdklib.internal.project.ProjectProperties$PropertyType loaded from ant loader (parentFirst)
Finding class com.android.sdklib.internal.project.ProjectProperties
Loaded from D:\Android-2.0\android-sdk-windows\tools\lib\sdklib.jar com/android/sdklib/internal/project/ProjectProperties.class
Class com.android.sdklib.internal.project.ProjectProperties loaded from ant loader (parentFirst)
Class java.util.Map loaded from parent loader (parentFirst)
Class java.io.OutputStream loaded from parent loader (parentFirst)
Class java.io.FileOutputStream loaded from parent loader (parentFirst)
Class java.lang.Throwable loaded from parent loader (parentFirst)
Class java.lang.AssertionError loaded from parent loader (parentFirst)
Class java.lang.Class loaded from parent loader (parentFirst)
Class java.util.HashMap loaded from parent loader (parentFirst)
Finding class com.android.sdklib.internal.project.ApkConfigurationHelper
Loaded from D:\Android-2.0\android-sdk-windows\tools\lib\sdklib.jar com/android/sdklib/internal/project/ApkConfigurationHelper.class
Class com.android.sdklib.internal.project.ApkConfigurationHelper loaded from ant loader (parentFirst)
Finding class com.android.sdklib.internal.project.ApkSettings
Loaded from D:\Android-2.0\android-sdk-windows\tools\lib\sdklib.jar com/android/sdklib/internal/project/ApkSettings.class
Class com.android.sdklib.internal.project.ApkSettings loaded from ant loader (parentFirst)
[antcall] Exiting E:\manish_test\timetrack\build\build-Android-1.0.xml.
BUILD FAILED
E:\manish_test\timetrack\build\build-Android-1.0.xml:371: The following error occurred while executing this line:
E:\manish_test\timetrack\build\build-Android-1.0.xml:302: java.lang.NullPointerException
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: E:\manish_test\timetrack\build\build-Android-1.0.xml:302: java.lang.NullPointerException
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
... 17 more
Caused by: java.lang.NullPointerException
at com.android.sdklib.internal.project.ApkConfigurationHelper.getSettings(ApkConfigurationHelper.java:31)
at com.android.ant.AaptExecLoopTask.execute(AaptExecLoopTask.java:137)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
... 24 more
--- Nested Exception ---
E:\manish_test\timetrack\build\build-Android-1.0.xml:302: java.lang.NullPointerException
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.NullPointerException
at com.android.sdklib.internal.project.ApkConfigurationHelper.getSettings(ApkConfigurationHelper.java:31)
at com.android.ant.AaptExecLoopTask.execute(AaptExecLoopTask.java:137)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
... 24 more
--- Nested Exception ---
java.lang.NullPointerException
at com.android.sdklib.internal.project.ApkConfigurationHelper.getSettings(ApkConfigurationHelper.java:31)
at com.android.ant.AaptExecLoopTask.execute(AaptExecLoopTask.java:137)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
答案 0 :(得分:0)
最后:
Caused by: java.lang.NullPointerException
at com.android.sdklib.internal.project.ApkConfigurationHelper.getSettings(ApkConfigurationHelper.java:31)
在这里很重要
您需要检查ApkConfigurationHelper
源代码,看看为什么它可以在这里抛出NPE。
答案 1 :(得分:0)
由于属性文件名和位置的硬编码,发现了解决方案异常。 ApkConfigurationHelper期望ant项目基目录中的default.properties文件和属性split.density应该在此文件中设置。 它现在就像一个魅力。
感谢所有人的帮助..
- Manish