IT Staff

Blog về chuyên ngành IT

[Android] Begin of the Beginning

leave a comment »

After an importing a previously working package into my Eclipse IDE All of my packages started producing errors specifically about not being able to find the native library directory that contained the “ANDROID_FRAMEWORK”. After some tinkering I decided that the best thing would be to start again and do a clean install of the IDE. I followed Google’s instructions for installation

http://developer.android.com/sdk/index.html

Using the latest Helios version of Eclipse. I created a new directory and workspace, linking to none of the resources from my old IDE in fact I trashed all of it before reinstalling.

I created a new “hello world” project to test the install. Upon creation the new package threw the following error.

“Unable to read /Developer_Android/Android-sdk/AndroidManifest.xml: java.io.FileNotFoundException: /Developer_Android/Android-sdk/AndroidManifest.xml (No such file or directory)”

Now this is what I was encountering before as well. This being a new install though I do not know what could be causing this. Unless there is some resource OUTSIDE the eclipse folder that is setting a preference that I inadvertently changed and remains intact after my deletion of the previous IDE.

Any Clarity anyone can lend to this situation would be helpful since all dev work is FULL STOP.

right-click project -> android tools -> fix project properties

This error occurs in setContentView line in this code snippet:

/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.main); 

I understand that in order for R.layout.main to be resolved, a file named res/layout/main.xml must be present.

It is present and valid (i.e. Eclipse marks it as perfect without any errors). So, what else could cause this error?

BTW, I already tried Project > Clean. The error persists.

 

Make sure you don’t have this in your imports:

import android.R; 

but:

import your.application.packagename.R; 

I keep getting this error… should I just make “id” a field? My code:

public void onCreate(Bundle icicle) {        super.onCreate(icicle);        setContentView(R.layout.main);      ImageView mainimage = (ImageView) findViewById(R.id.mainanim);      mainimage.setBackgroundResource(R.anim.mainanim);      mainanimation = (AnimationDrawable) mainimage.getBackground(); 

How exactly do you fix this?

Do not modify the R class. The error means there’s something syntactically wrong with your XML layouts and R cannot be auto-generated. Try looking there and post the xml code you’re not sure about, if any.

Written by Xavier

Tháng Tư 28, 2012 lúc 7:19 chiều

Posted in Android

Tagged with

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: