构建/编译“Hello World”期间出错适用于安卓

发布于 2024-12-15 06:03:00 字数 15723 浏览 1 评论 0原文

我有一个编译问题。我按照有关 Android 的“Hello world”程序的教程进行操作,并且成功地编译并运行了该程序几次。但是第二天,当我打开计算机时,我尝试再次运行该程序,它给了我以下错误:

"C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml:83: The following error occurred while executing this line: 
C:\Program Files\Android\android-sdk\tools\ant\build.xml:65: taskdef A class needed by class com.android.ant.NewSetupTask cannot be found: com/android/sdklib/ISdkLog using the classloader AntClassLoader[C:\Program Files\Android\android-sdk\tools\lib\anttasks.jar]". 

当我搜索互联网(以及StackOverflow.com)时,我发现的只是有关“taskdef class com.android”的讨论.ant.SetupTask 找不到”问题,但这没有帮助,因为我没有这个错误。我检查了我的路径(local.properties、build.xml、Andoid SDK 的路径),一切看起来都很好(昨天一切都很顺利,从那以后我没有碰/更改任何东西,现在我无法构建/运行应用程序)。我尝试了“清理并构建”,它给了我同样的错误。

我正在使用 Netbeans 7.0.1 和 nbandroid 插件 (7.0+)。我安装了 Android 4 (API 14) 和 Android 2.2 (API 8)。它给了我同样的错误。我运行的是 Windows XP SP3。

源代码:

package org.brokenbyte.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android!");
        setContentView(tv);
    }
}

这是完整的调试输出:

Adding reference: ant.PropertyHelper
Detected Java version: 1.7 in: C:\Program Files\Java\jdk1.7.0\jre
Detected OS: Windows XP
Adding reference: ant.ComponentHelper
Trying to override old definition of task java
 +Datatype java org.apache.tools.ant.module.bridge.impl.ForkedJavaOverride
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-ant-browsetask.jar!/org/netbeans/modules/ant/browsetask/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-ant-browsetask.jar!/org/netbeans/modules/ant/browsetask/antlib.xml from a zip file
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 +Datatype nbbrowse org.netbeans.modules.ant.browsetask.NbBrowse
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-ant-browsetask.jar!/org/netbeans/modules/ant/browsetask/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-ant-browsetask.jar!/org/netbeans/modules/ant/browsetask/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.ant.browsetask:nbbrowse org.netbeans.modules.ant.browsetask.NbBrowse
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/profiler/ant/nblib/org-netbeans-modules-profiler.jar!/org/netbeans/modules/profiler/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/profiler/ant/nblib/org-netbeans-modules-profiler.jar!/org/netbeans/modules/profiler/antlib.xml from a zip file
 +Datatype nbprofileattach org.netbeans.modules.profiler.ant.NBProfileAttachTask
 +Datatype nbprofiledirect org.netbeans.modules.profiler.ant.NBProfileDirectTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/profiler/ant/nblib/org-netbeans-modules-profiler.jar!/org/netbeans/modules/profiler/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/profiler/ant/nblib/org-netbeans-modules-profiler.jar!/org/netbeans/modules/profiler/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.profiler:nbprofileattach org.netbeans.modules.profiler.ant.NBProfileAttachTask
 +Datatype antlib:org.netbeans.modules.profiler:nbprofiledirect org.netbeans.modules.profiler.ant.NBProfileDirectTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/apisupport/ant/nblib/org-netbeans-modules-apisupport-ant.jar!/org/netbeans/modules/apisupport/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/apisupport/ant/nblib/org-netbeans-modules-apisupport-ant.jar!/org/netbeans/modules/apisupport/ant/antlib.xml from a zip file
 +Datatype nbinstaller org.netbeans.modules.apisupport.ant.InstallModuleTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/apisupport/ant/nblib/org-netbeans-modules-apisupport-ant.jar!/org/netbeans/modules/apisupport/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/apisupport/ant/nblib/org-netbeans-modules-apisupport-ant.jar!/org/netbeans/modules/apisupport/ant/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.apisupport.ant:nbinstaller org.netbeans.modules.apisupport.ant.InstallModuleTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml from a zip file
 +Datatype nbjpdaconnect org.netbeans.modules.debugger.jpda.ant.JPDAConnect
 +Datatype nbjpdastart org.netbeans.modules.debugger.jpda.ant.JPDAStart
 +Datatype sourcepath org.netbeans.modules.debugger.jpda.ant.JPDAStart$Sourcepath
 +Datatype nbjpdareload org.netbeans.modules.debugger.jpda.ant.JPDAReload
 +Datatype nbjpdaappreloaded org.netbeans.modules.debugger.jpda.ant.JPDAAppReloaded
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:nbjpdaconnect org.netbeans.modules.debugger.jpda.ant.JPDAConnect
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:nbjpdastart org.netbeans.modules.debugger.jpda.ant.JPDAStart
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:sourcepath org.netbeans.modules.debugger.jpda.ant.JPDAStart$Sourcepath
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:nbjpdareload org.netbeans.modules.debugger.jpda.ant.JPDAReload
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:nbjpdaappreloaded org.netbeans.modules.debugger.jpda.ant.JPDAAppReloaded
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-javawebstart.jar!/org/netbeans/modules/javawebstart/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-javawebstart.jar!/org/netbeans/modules/javawebstart/antlib.xml from a zip file
 +Datatype jnlpsignjars org.netbeans.modules.javawebstart.SignJarsTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-javawebstart.jar!/org/netbeans/modules/javawebstart/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-javawebstart.jar!/org/netbeans/modules/javawebstart/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.javawebstart:jnlpsignjars org.netbeans.modules.javawebstart.SignJarsTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-java-source-ant.jar!/org/netbeans/modules/java/source/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-java-source-ant.jar!/org/netbeans/modules/java/source/ant/antlib.xml from a zip file
Trying to override old definition of task javac
 +Datatype javac org.netbeans.modules.java.source.ant.JavacTask
 +Datatype translate-classpath org.netbeans.modules.java.source.ant.TranslateClassPath
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-java-source-ant.jar!/org/netbeans/modules/java/source/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-java-source-ant.jar!/org/netbeans/modules/java/source/ant/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.java.source.ant:javac org.netbeans.modules.java.source.ant.JavacTask
 +Datatype antlib:org.netbeans.modules.java.source.ant:translate-classpath org.netbeans.modules.java.source.ant.TranslateClassPath
Setting ro project property: ant.file -> C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml
Setting ro project property: ant.version -> Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Setting ro project property: ant.home -> C:\Program Files\NetBeans 7.0.1\java\ant
Setting project property: ant.junit.enabletestlistenerevents -> true
Setting ro project property: build.compiler.emacs -> true
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml with URI = file:/C:/Documents%20and%20Settings/sh0ne/My%20Documents/NetBeansProjects/HelloAndroid/build.xml
Setting ro project property: ant.project.name -> HelloAndroid
Adding reference: HelloAndroid
Setting ro project property: ant.project.default-target -> help
Setting ro project property: ant.file.HelloAndroid -> C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml
Setting ro project property: ant.file.type.HelloAndroid -> file
Project base dir set to: C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid
 +Target: 
Adding reference: ant.LocalProperties
Setting project property: sdk.dir -> C:\Program Files\Android\android-sdk
Loading C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\ant.properties
Setting project property: target -> android-8
Importing file C:\Program Files\Android\android-sdk\tools\ant\build.xml from C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml
Overriding previous definition of reference to ant.projectHelper
Adding reference: ant.projectHelper
parsing buildfile C:\Program Files\Android\android-sdk\tools\ant\build.xml with URI = file:/C:/Program%20Files/Android/android-sdk/tools/ant/build.xml
Setting ro project property: ant.file. -> C:\Program Files\Android\android-sdk\tools\ant\build.xml
Setting ro project property: ant.file.type. -> file
 +Target: all
 +Target: clean
 +Target: -setup
 +Target: -build-setup
 +Target: -pre-build
 +Target: -code-gen
 +Target: -pre-compile
 +Target: -compile
 +Target: -post-compile
 +Target: -obfuscate
 +Target: -dex
 +Target: -crunch
 +Target: -package-resources
 +Target: -package
 +Target: -set-mode-check
 +Target: -set-debug-files
 +Target: -set-debug-mode
 +Target: -debug-obfuscation-check
 +Target: -do-debug
 +Target: debug
 +Target: -release-prompt-for-password
 +Target: -release-nosign
 +Target: -release-obfuscation-check
 +Target: -set-release-mode
 +Target: release
 +Target: -set-instrumented-mode
 +Target: instrument
 +Target: emma
 +Target: -test-project-check
 +Target: test
 +Target: install
 +Target: installd
 +Target: installr
 +Target: installi
 +Target: installt
 +Target: uninstall
 +Target: help
Setting project property: adb.device.arg -> 
Setting project property: android.package.excludes -> 
Setting project property: version.code -> 
Setting project property: version.name -> 
Setting project property: aapt.resource.filter -> 
Setting project property: java.encoding -> UTF-8
Setting project property: java.target -> 1.5
Setting project property: java.source -> 1.5
Setting project property: verbose -> false
Adding reference: android.antlibs
Finding class com.android.ant.NewSetupTask
Loaded from C:\Program Files\Android\android-sdk\tools\lib\anttasks.jar com/android/ant/NewSetupTask.class
Class org.apache.tools.ant.Task loaded from parent loader (parentFirst)
Class com.android.ant.NewSetupTask loaded from ant loader (parentFirst)
Class java.lang.Object loaded from parent loader (parentFirst)
Class java.lang.Throwable loaded from parent loader (parentFirst)
Class org.apache.tools.ant.BuildException loaded from parent loader (parentFirst)
Finding class com.android.sdklib.ISdkLog
C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml:83: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk\tools\ant\build.xml:65: taskdef A class needed by class com.android.ant.NewSetupTask cannot be found: com/android/sdklib/ISdkLog using the classloader AntClassLoader[C:\Program Files\Android\android-sdk\tools\lib\anttasks.jar]
    at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:551)
    at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:234)
    at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:163)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    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:390)
    at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:180)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:230)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: C:\Program Files\Android\android-sdk\tools\ant\build.xml:65: taskdef A class needed by class com.android.ant.NewSetupTask cannot be found: com/android/sdklib/ISdkLog using the classloader AntClassLoader[C:\Program Files\Android\android-sdk\tools\lib\anttasks.jar]
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:627)
    at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:239)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    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:390)
    at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:169)
    at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:225)
    ... 12 more
Caused by: java.lang.NoClassDefFoundError: com/android/sdklib/ISdkLog
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:594)
    ... 22 more
Caused by: java.lang.ClassNotFoundException: com.android.sdklib.ISdkLog
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 25 more

我不明白发生了什么。请帮忙。

PS:抱歉我的英语不好,这不是我的母语。

I have a compiling problem. I followed tutorial about "Hello world" program for Android and I've managed to compile and run the program successfuly a couple of times. But the next day when I turned on computer, I tried to run the program again and it gave me the following error:

"C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml:83: The following error occurred while executing this line: 
C:\Program Files\Android\android-sdk\tools\ant\build.xml:65: taskdef A class needed by class com.android.ant.NewSetupTask cannot be found: com/android/sdklib/ISdkLog using the classloader AntClassLoader[C:\Program Files\Android\android-sdk\tools\lib\anttasks.jar]". 

When I searched the Internet (and also StackOverflow.com), all I found is discussions about "taskdef class com.android.ant.SetupTask cannot be found" problem, but that doesn't help as I don't have that error. I've checked my paths (local.properties, build.xml, path to Andoid SDK) and everything seems fine (yesterday everything worked like a charm, since then I didn't touch/change anything and now I cannot build/run the app). I tried "Clean and Build", it gives me the same error.

I am using Netbeans 7.0.1 with nbandroid plugin (7.0+). I installed Android 4 (API 14) and Android 2.2 (API 8). It gives me the same error for both. I am running Windows XP SP3.

Source Code:

package org.brokenbyte.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android!");
        setContentView(tv);
    }
}

And here is the complete debug output:

Adding reference: ant.PropertyHelper
Detected Java version: 1.7 in: C:\Program Files\Java\jdk1.7.0\jre
Detected OS: Windows XP
Adding reference: ant.ComponentHelper
Trying to override old definition of task java
 +Datatype java org.apache.tools.ant.module.bridge.impl.ForkedJavaOverride
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-ant-browsetask.jar!/org/netbeans/modules/ant/browsetask/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-ant-browsetask.jar!/org/netbeans/modules/ant/browsetask/antlib.xml from a zip file
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 +Datatype nbbrowse org.netbeans.modules.ant.browsetask.NbBrowse
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-ant-browsetask.jar!/org/netbeans/modules/ant/browsetask/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-ant-browsetask.jar!/org/netbeans/modules/ant/browsetask/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.ant.browsetask:nbbrowse org.netbeans.modules.ant.browsetask.NbBrowse
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/profiler/ant/nblib/org-netbeans-modules-profiler.jar!/org/netbeans/modules/profiler/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/profiler/ant/nblib/org-netbeans-modules-profiler.jar!/org/netbeans/modules/profiler/antlib.xml from a zip file
 +Datatype nbprofileattach org.netbeans.modules.profiler.ant.NBProfileAttachTask
 +Datatype nbprofiledirect org.netbeans.modules.profiler.ant.NBProfileDirectTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/profiler/ant/nblib/org-netbeans-modules-profiler.jar!/org/netbeans/modules/profiler/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/profiler/ant/nblib/org-netbeans-modules-profiler.jar!/org/netbeans/modules/profiler/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.profiler:nbprofileattach org.netbeans.modules.profiler.ant.NBProfileAttachTask
 +Datatype antlib:org.netbeans.modules.profiler:nbprofiledirect org.netbeans.modules.profiler.ant.NBProfileDirectTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/apisupport/ant/nblib/org-netbeans-modules-apisupport-ant.jar!/org/netbeans/modules/apisupport/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/apisupport/ant/nblib/org-netbeans-modules-apisupport-ant.jar!/org/netbeans/modules/apisupport/ant/antlib.xml from a zip file
 +Datatype nbinstaller org.netbeans.modules.apisupport.ant.InstallModuleTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/apisupport/ant/nblib/org-netbeans-modules-apisupport-ant.jar!/org/netbeans/modules/apisupport/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/apisupport/ant/nblib/org-netbeans-modules-apisupport-ant.jar!/org/netbeans/modules/apisupport/ant/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.apisupport.ant:nbinstaller org.netbeans.modules.apisupport.ant.InstallModuleTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml from a zip file
 +Datatype nbjpdaconnect org.netbeans.modules.debugger.jpda.ant.JPDAConnect
 +Datatype nbjpdastart org.netbeans.modules.debugger.jpda.ant.JPDAStart
 +Datatype sourcepath org.netbeans.modules.debugger.jpda.ant.JPDAStart$Sourcepath
 +Datatype nbjpdareload org.netbeans.modules.debugger.jpda.ant.JPDAReload
 +Datatype nbjpdaappreloaded org.netbeans.modules.debugger.jpda.ant.JPDAAppReloaded
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-debugger-jpda-ant.jar!/org/netbeans/modules/debugger/jpda/ant/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:nbjpdaconnect org.netbeans.modules.debugger.jpda.ant.JPDAConnect
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:nbjpdastart org.netbeans.modules.debugger.jpda.ant.JPDAStart
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:sourcepath org.netbeans.modules.debugger.jpda.ant.JPDAStart$Sourcepath
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:nbjpdareload org.netbeans.modules.debugger.jpda.ant.JPDAReload
 +Datatype antlib:org.netbeans.modules.debugger.jpda.ant:nbjpdaappreloaded org.netbeans.modules.debugger.jpda.ant.JPDAAppReloaded
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-javawebstart.jar!/org/netbeans/modules/javawebstart/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-javawebstart.jar!/org/netbeans/modules/javawebstart/antlib.xml from a zip file
 +Datatype jnlpsignjars org.netbeans.modules.javawebstart.SignJarsTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-javawebstart.jar!/org/netbeans/modules/javawebstart/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-javawebstart.jar!/org/netbeans/modules/javawebstart/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.javawebstart:jnlpsignjars org.netbeans.modules.javawebstart.SignJarsTask
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-java-source-ant.jar!/org/netbeans/modules/java/source/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-java-source-ant.jar!/org/netbeans/modules/java/source/ant/antlib.xml from a zip file
Trying to override old definition of task javac
 +Datatype javac org.netbeans.modules.java.source.ant.JavacTask
 +Datatype translate-classpath org.netbeans.modules.java.source.ant.TranslateClassPath
parsing buildfile jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-java-source-ant.jar!/org/netbeans/modules/java/source/ant/antlib.xml with URI = jar:file:/C:/Program%20Files/NetBeans%207.0.1/java/ant/nblib/org-netbeans-modules-java-source-ant.jar!/org/netbeans/modules/java/source/ant/antlib.xml from a zip file
 +Datatype antlib:org.netbeans.modules.java.source.ant:javac org.netbeans.modules.java.source.ant.JavacTask
 +Datatype antlib:org.netbeans.modules.java.source.ant:translate-classpath org.netbeans.modules.java.source.ant.TranslateClassPath
Setting ro project property: ant.file -> C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml
Setting ro project property: ant.version -> Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Setting ro project property: ant.home -> C:\Program Files\NetBeans 7.0.1\java\ant
Setting project property: ant.junit.enabletestlistenerevents -> true
Setting ro project property: build.compiler.emacs -> true
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml with URI = file:/C:/Documents%20and%20Settings/sh0ne/My%20Documents/NetBeansProjects/HelloAndroid/build.xml
Setting ro project property: ant.project.name -> HelloAndroid
Adding reference: HelloAndroid
Setting ro project property: ant.project.default-target -> help
Setting ro project property: ant.file.HelloAndroid -> C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml
Setting ro project property: ant.file.type.HelloAndroid -> file
Project base dir set to: C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid
 +Target: 
Adding reference: ant.LocalProperties
Setting project property: sdk.dir -> C:\Program Files\Android\android-sdk
Loading C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\ant.properties
Setting project property: target -> android-8
Importing file C:\Program Files\Android\android-sdk\tools\ant\build.xml from C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml
Overriding previous definition of reference to ant.projectHelper
Adding reference: ant.projectHelper
parsing buildfile C:\Program Files\Android\android-sdk\tools\ant\build.xml with URI = file:/C:/Program%20Files/Android/android-sdk/tools/ant/build.xml
Setting ro project property: ant.file. -> C:\Program Files\Android\android-sdk\tools\ant\build.xml
Setting ro project property: ant.file.type. -> file
 +Target: all
 +Target: clean
 +Target: -setup
 +Target: -build-setup
 +Target: -pre-build
 +Target: -code-gen
 +Target: -pre-compile
 +Target: -compile
 +Target: -post-compile
 +Target: -obfuscate
 +Target: -dex
 +Target: -crunch
 +Target: -package-resources
 +Target: -package
 +Target: -set-mode-check
 +Target: -set-debug-files
 +Target: -set-debug-mode
 +Target: -debug-obfuscation-check
 +Target: -do-debug
 +Target: debug
 +Target: -release-prompt-for-password
 +Target: -release-nosign
 +Target: -release-obfuscation-check
 +Target: -set-release-mode
 +Target: release
 +Target: -set-instrumented-mode
 +Target: instrument
 +Target: emma
 +Target: -test-project-check
 +Target: test
 +Target: install
 +Target: installd
 +Target: installr
 +Target: installi
 +Target: installt
 +Target: uninstall
 +Target: help
Setting project property: adb.device.arg -> 
Setting project property: android.package.excludes -> 
Setting project property: version.code -> 
Setting project property: version.name -> 
Setting project property: aapt.resource.filter -> 
Setting project property: java.encoding -> UTF-8
Setting project property: java.target -> 1.5
Setting project property: java.source -> 1.5
Setting project property: verbose -> false
Adding reference: android.antlibs
Finding class com.android.ant.NewSetupTask
Loaded from C:\Program Files\Android\android-sdk\tools\lib\anttasks.jar com/android/ant/NewSetupTask.class
Class org.apache.tools.ant.Task loaded from parent loader (parentFirst)
Class com.android.ant.NewSetupTask loaded from ant loader (parentFirst)
Class java.lang.Object loaded from parent loader (parentFirst)
Class java.lang.Throwable loaded from parent loader (parentFirst)
Class org.apache.tools.ant.BuildException loaded from parent loader (parentFirst)
Finding class com.android.sdklib.ISdkLog
C:\Documents and Settings\sh0ne\My Documents\NetBeansProjects\HelloAndroid\build.xml:83: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk\tools\ant\build.xml:65: taskdef A class needed by class com.android.ant.NewSetupTask cannot be found: com/android/sdklib/ISdkLog using the classloader AntClassLoader[C:\Program Files\Android\android-sdk\tools\lib\anttasks.jar]
    at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:551)
    at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:234)
    at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:163)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    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:390)
    at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:180)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:230)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: C:\Program Files\Android\android-sdk\tools\ant\build.xml:65: taskdef A class needed by class com.android.ant.NewSetupTask cannot be found: com/android/sdklib/ISdkLog using the classloader AntClassLoader[C:\Program Files\Android\android-sdk\tools\lib\anttasks.jar]
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:627)
    at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:239)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    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:390)
    at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:169)
    at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:225)
    ... 12 more
Caused by: java.lang.NoClassDefFoundError: com/android/sdklib/ISdkLog
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:594)
    ... 22 more
Caused by: java.lang.ClassNotFoundException: com.android.sdklib.ISdkLog
    at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361)
    at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 25 more

I don't understand what happened. Please help.

PS: Sorry for my bad english, it's not my native language.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

贪恋 2024-12-22 06:03:00

检查日志文件清楚地表明 com.android.sdklib.ISdkLog 类不在 Ant 的类路径中。这会导致找不到类 com.android.ant.NewSetupTask 的问题。

看来您的机器上没有安装 android SDK,或者至少用于构建 android 项目的 ant 任务不在 Ant 的类路径中。我认为第二个选项更相关。在这种情况下,您应该找到适当的 jar 文件并将其添加到 ant/lib 中。

Examining your log file clearly shows that class com.android.sdklib.ISdkLog is not in classpath of Ant. This causes problem that class com.android.ant.NewSetupTask is not found.

It seems that either android SDK is not installed on you machine or at least ant tasks that are used to build android project are not in classpath of Ant. I think that the second option is more relevant. In this case you should find appropriate jar file and add it to ant/lib.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文