Saurabh S
Saurabh S

Reputation: 15

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.

Upvotes: 1

Views: 5114

Answers (1)

mattfred
mattfred

Reputation: 2749

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"); )

Upvotes: 2

Related Questions