• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Can't Execute the app, says "Local path doesn't exist"

sumchans

Lurker
May 1, 2012
8
0
Hi all,

New to this group and also new to app development. Following the tutorial on developer.android.com which was mainly prepared for Eclipse, but I am working the code out on Android Studio. Finished the first section, but when executing it says "Local path doesn't exist". Also the code shows some errors too.

The code from the MainActitivty class:

public class MainActivity extends Activity {

public final static String EXTRA_MESSAGE = "com.sumchans.myfirstapp.MESSAGE";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void sendMessage(View v){
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText)findViewById(R.id.edit_message);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE,message);
startActivity(intent);
}

The underlined part of the code on top has a green line under it.

Code from the DisplayMessageActivity class:


public class DisplayMessageActivity extends Activity {
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
}

The underlined part of the code says: "Gradle: error: cannot find symbol variable NavUtils"

File is also attached.

Somebody please advise.

Thank you.
 

Attachments

  • MyFirstAppProject.zip
    220.8 KB · Views: 48

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones