2012-03-16 108 views
0

我有这样的源文件:我的日志消息在哪里?

... 
import android.util.Log; 
... 
public class MyActivity extends Activity 
{ 
    public static Activity activity = null; 
    private static final String TAG = "WorldDetermine"; 
    private Camera mCamera; 
    private CameraPreview mPreview; 
    public final int cameraId = 0; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
    Log.d("myTag", "onCreate started!"); 
    Log.v("blah", "blah blah"); 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); ... 

,并试图获得通过logcat日志消息。就像这样:

adb -s emulator-5554 logcat myTag:D blah:v *:S 

但只有空白输出(grep也没有找到它)。我的项目由ant debug编译正常,但我对最后一步的问题(该问题是否可以通过这种间接引起的?):

debug: 

BUILD FAILED 
/home/psct/development/android-sdk-linux/tools/ant/build.xml:887: The following error occurred while executing this line: 
/home/psct/development/android-sdk-linux/tools/ant/build.xml:342: The following error occurred while executing this line: 
/home/psct/development/android-sdk-linux/tools/ant/build.xml:334: Problem: failed to create task or type propertyfile 
Cause: the class org.apache.tools.ant.taskdefs.optional.PropertyFile was not found. 
     This looks like one of Ant's optional components. 
Action: Check that the appropriate optional JAR exists in 
     -/usr/share/ant-core/lib 
     -/root/.ant/lib 
     -a directory added on the command line with the -lib argument 

Do not panic, this is a common problem. 
The commonest cause is a missing JAR. 

This is not a bug; it is a configuration problem 


Total time: 4 seconds 

回答

0

开始DDMS在/ Android的SDK/tools文件夹的文件,你会看到详细为选定的设备输出。日志将被输出。没有需要使用控制台:)

+0

和...这对我没有帮助 – psct 2012-03-17 21:19:04

+1

在输出日志中,您可以看到项目中的任何现有错误(除了您自己的日志)。你可以通过标签,pid,应用程序,文本搜索它们。不需要控制台。 无论如何,你有在项目中导入apache库的问题。这就是为什么没有日志打印出来。你有没有检查过项目属性/ Java_Build_Path。尝试“添加外部JAR”并选择你拥有的apache jar文件。 “操作:检查相应的可选JAR是否存在..这是一个配置问题” – bajicdusko 2012-03-18 16:30:32

+0

以及该文件是什么?如你所知? – psct 2012-03-19 16:24:35