在令牌QUOT语法错误;}&QUOT ;,删除此令牌 [英] Syntax error on token "}", delete this token

查看:656
本文介绍了在令牌QUOT语法错误;}&QUOT ;,删除此令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断收到这个错误说:令牌语法错误},删除此标记。在最后一行,为什么呢?我已经寻找了错误,但我似乎无法找到它。正如你可以看到它的服务,在一段时间调用另一个服务的每一次。

 包com.iggeman.updater;进口android.app.Service;
进口android.content.Intent;
进口android.os.IBinder;
进口android.util.Log;公共类UpdaterService延伸服务{私有静态最后的字符串标记= UpdaterService.class
        .getSimpleName();
私人更新更新;
公共布尔isRunning = FALSE;@覆盖
公众的IBinder onBind(意向意图){
    // TODO自动生成方法存根
    返回null;
}@覆盖
公共无效的onCreate(){
    // TODO自动生成方法存根
    super.onCreate();    更新=新的更新程序();    Log.d(TAG的onCreate);
}@覆盖
公共无效调用onStart(意向意图,诠释startId){
    // TODO自动生成方法存根
    super.onStart(意向,startId);    如果(this.isRunning == FALSE){
        updater.start();
        this.isRunning = TRUE;
    }    Log.d(TAG,在onStart);
}@覆盖
公共同步无效的onDestroy(){
    // TODO自动生成方法存根
    super.onDestroy();    如果(this.isRunning){
        updater.interrupt();
    }    更新= NULL;    Log.d(TAG的onDestroy);
}类更新继承Thread {
    静态最后长的延迟= 10000;
    私人布尔isRunning = FALSE;    公共更新(){
        超级(更新);
    }    @覆盖
    公共无效的run(){
        // TODO自动生成方法存根
        super.run();
        isRunning = TRUE;
        而(isRunning){
            尝试{
                // 做一点事                startService(新意图(getBaseContext(),StartServiceTwo.class));                Log.d(TAG,更新运行);                视频下载(延迟);
            }赶上(InterruptedException的E){
                //中断
                isRunning = FALSE;
            }
        } //而
    }    公共布尔isRunning(){
        返回this.isRunning();
    }
}
}

我已经完成了所有的支架消失了,我找不到任何人,是不是它应该是。

编辑:

尽管如此错误:

 包com.iggeman.updater;进口android.app.Service;
进口android.content.Intent;
进口android.os.IBinder;
进口android.util.Log;公共类UpdaterService延伸服务{私有静态最后的字符串标记= UpdaterService.class
        .getSimpleName();
私人更新更新;
公共布尔isRunning = FALSE;@覆盖
公众的IBinder onBind(意向意图){
    // TODO自动生成方法存根
    返回null;
}@覆盖
公共无效的onCreate(){
    // TODO自动生成方法存根
    super.onCreate();    更新=新的更新程序();    Log.d(TAG的onCreate);
}@覆盖
公共无效调用onStart(意向意图,诠释startId){
    // TODO自动生成方法存根
    super.onStart(意向,startId);    如果(this.isRunning == FALSE){
        updater.start();
        this.isRunning = TRUE;
    }    Log.d(TAG,在onStart);
}@覆盖
公共同步无效的onDestroy(){
    // TODO自动生成方法存根
    super.onDestroy();    如果(this.isRunning){
        updater.interrupt();
    }    更新= NULL;    Log.d(TAG的onDestroy);
}类更新继承Thread {
    静态最后长的延迟= 10000;
    私人布尔isRunning = FALSE;    公共更新(){
        超级(更新);
    }    @覆盖
    公共无效的run(){
        // TODO自动生成方法存根
        super.run();
        isRunning = TRUE;
        而(isRunning){
            尝试{
                // 做一点事                startService(新意图(getBaseContext(),StartServiceTwo.class));                Log.d(TAG,更新运行);                视频下载(延迟);
            }赶上(InterruptedException的E){
                //中断
                isRunning = FALSE;
            }
        } //而
    } //跑
} //类更新公共布尔isRunning(){
        返回this.isRunning();
   }
} //主体


解决方案

这很可能不是一个问题,你的code,但是Eclipse。重新启动计算机,然后重新生成项目。

如果还是不行,请尝试使用其他程序编译。如果成功,那么它只是Eclipse的是奇怪的。

I keep getting this error saying "Syntax error on token "}", delete this token." on the last line, why? I have searching for the error but I can't seem to find it. As you can see it's a service, calling on another service every once in a while.

package com.iggeman.updater;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class UpdaterService extends Service {

private static final String TAG = UpdaterService.class
        .getSimpleName();
private Updater updater;
public boolean isRunning = false;

@Override
public IBinder onBind(Intent intent) {
    // TODO Auto-generated method stub
    return null;
}

@Override
public void onCreate() {
    // TODO Auto-generated method stub
    super.onCreate();

    updater = new Updater();

    Log.d(TAG, "onCreate");
}

@Override
public void onStart(Intent intent, int startId) {
    // TODO Auto-generated method stub
    super.onStart(intent, startId);

    if (this.isRunning == false) {
        updater.start();
        this.isRunning = true;
    }

    Log.d(TAG, "onStart");
}

@Override
public synchronized void onDestroy() {
    // TODO Auto-generated method stub
    super.onDestroy();

    if (this.isRunning) {
        updater.interrupt();
    }

    updater = null;

    Log.d(TAG, "onDestroy");
}

class Updater extends Thread {
    static final long DELAY = 10000;
    private boolean isRunning = false;

    public Updater() {
        super("Updater");
    }

    @Override
    public void run() {
        // TODO Auto-generated method stub
        super.run();
        isRunning = true;
        while (isRunning) {
            try {
                // Do something

                startService(new Intent(getBaseContext(), StartServiceTwo.class));

                Log.d(TAG, "Updater running");

                Thread.sleep(DELAY);
            } catch (InterruptedException e) {
                // interrupted
                isRunning = false;
            }
        } // while
    }

    public boolean isRunning() {
        return this.isRunning();
    }
}
}

I have gone through all the brackets and I can't find anyone that isn't where it's supposed to be.

Edit:

Still the error:

package com.iggeman.updater;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class UpdaterService extends Service {

private static final String TAG = UpdaterService.class
        .getSimpleName();
private Updater updater;
public boolean isRunning = false;

@Override
public IBinder onBind(Intent intent) {
    // TODO Auto-generated method stub
    return null;
}

@Override
public void onCreate() {
    // TODO Auto-generated method stub
    super.onCreate();

    updater = new Updater();

    Log.d(TAG, "onCreate");
}

@Override
public void onStart(Intent intent, int startId) {
    // TODO Auto-generated method stub
    super.onStart(intent, startId);

    if (this.isRunning == false) {
        updater.start();
        this.isRunning = true;
    }

    Log.d(TAG, "onStart");
}

@Override
public synchronized void onDestroy() {
    // TODO Auto-generated method stub
    super.onDestroy();

    if (this.isRunning) {
        updater.interrupt();
    }

    updater = null;

    Log.d(TAG, "onDestroy");
}

class Updater extends Thread {
    static final long DELAY = 10000;
    private boolean isRunning = false;

    public Updater() {
        super("Updater");
    }

    @Override
    public void run() {
        // TODO Auto-generated method stub
        super.run();
        isRunning = true;
        while (isRunning) {
            try {
                // Do something

                startService(new Intent(getBaseContext(), StartServiceTwo.class));

                Log.d(TAG, "Updater running");

                Thread.sleep(DELAY);
            } catch (InterruptedException e) {
                // interrupted
                isRunning = false;
            }
        } // while
    } //Run     
} //Class updater

public boolean isRunning() {
        return this.isRunning();
   }
}  //Main body

解决方案

This is likely not an issue with your code, but Eclipse. Restart the computer, and then re-build the project.

If that does not work, try compiling with another program. If it works, then it's just Eclipse being weird.

这篇关于在令牌QUOT语法错误;}&QUOT ;,删除此令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆