Creating Android projects and common error resolution

Source: Internet
Author: User

First open eclipse, click on the top right corner with this little button, click Java and OK

Because it's more convenient to switch to this view to create an Android program, then click

Next

Next

This place can modify the Android app icon.

Next

Next

Finish, then wait for a while, the mouse does not move. If the mouse goes to other places it is easy to get an unknown error.

New and good Android programs often have some of these errors:

1.warning:unable to write jarlist cache file

Workaround: http://jingyan.baidu.com/article/3aed632e1a79eb70108091c3.html

2.r.java file error (or Maniactivity.java with a yellow warning):

This error often occurs when comparing the programs created by the new ADT plugin

Workaround: Open this file,

To delete this part of the middle.
@Override
public boolean Oncreateoptionsmenu (Menu menu) {
Inflate the menu; This adds items to the action bar if it is present.
Getmenuinflater (). Inflate (R.menu.main, menu);
return true;
}

@Override
public boolean onoptionsitemselected (MenuItem item) {
Handle Action Bar Item clicks here. The Action Bar would
Automatically handle clicks on the Home/up button, so long
As you specify a the parent activity in Androidmanifest.xml.
int id = item.getitemid ();
if (id = = r.id.action_settings) {
return true;
}
return super.onoptionsitemselected (item);
}

Then put the mouse on the yellow warning code, according to the prompt to make the corresponding changes

Then Ctrl+shift+o guide the bag,

The code after the modification is like this, and all the errors are resolved.

A successful Android project has been created.



A summary of some assorted (everyone can ignore):

I found out today that when creating an Android project, compile with has the option to select the highest 22

, the project created will not go wrong, but there will be a yellow warning,
Then compile with the option to create the project with the other API will have an error.
This error is the same as the error I created with a separate Eclipse and ADT project.
So I was thinking that the error that preceded it might not be because of eclipse, but because of the different APIs that caused
The error. In that case, I might as well just use eclipse directly,
And then the error can be solved, that is, remove unnecessary code
Is the redundant code in the Mainactivity.java, and then you can eliminate this by following the prompts.
Error.

It turns out that I was right.

The Android project I created was inherited by Actionbaractivity, and then this was outdated
In the video is the inherited activity. This is not a warning.
Go online and find out how to get him into the activity.

For version compatibility, you select 4.0 or more of the minimum version when you create a new project.
There will be no APPCOMPAT_V7 package, Androidbaractivity is supported in the library
Classes can be compatible with 2.x versions
The activity provided by Actionbar is only available for more than 3.0


I've tried it, and I've built a new one that would extends Activity if it was above 4.0.
But not including 4.0 and 4.0x,4.0 to build a good src inside there is no thing. No Java files.
So let him inherit from the actionbaractivity better.

There are SDK build tools and the following in addition to Paltform in the SDK components of Android to download
Android Support Library and Google usb driver in extras, without Android support library
An error occurs when you create a project.

Creating Android projects and common error resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.