简体   繁体   中英

Unexpected Token Error in Android Studio

package com.hello_world.helloworld;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.util.log;


public class HelloWorld extends AppCompatActivity {

    private static final String TAG - "My Message";

Another error it says is that Private field 'TAG' is never used. I am unsure why i am getting these errors and I need help solving them. I tried to solve this issue with some other solutions but none of them seem to work.

First, I believe there is a syntax error. It should probably be:

private static final String TAG = "My Message";

Secondly, the error just means that this line of code is never used. To solve it, just delete that line of code. (Alternately, you could use it somewhere like Log.i(TAG, "Application Running"); )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM