So...I first tried NetBeans, and I had everything working again cept for this error about the package "R".

So, then I went to eclipse and followed instructions of everything and again the error is there too.

I am really lost with this and it always involves with this R package..any suggestions/help please?


Thanks,
-Austin

Recommended Answers

All 12 Replies

1) moved to Mobile Development section
2) make sure that no of your classes has following import import android.R; otherwise IDE would not be able solve resources properly
3) sometimes you may get warning about IDE not to able resolve something in R because many tutorials do activities and other Java classes examples before XML layouts

PS: Forget NetBeans they are far behind Android support, use either Eclipse or IntelliJ Community edition (personally I use IntelliJ, there is new version coming out with some new additions/improvements to Android development)

Ok, I'll work on following that tutorial as well, one thing though I've noticed so far.
They said there would be a XML file when you create the Android project and I do not see one, all I have is this

I guess you are referring to "After you create one or more Android projects, an entry for "Android XML File" will also be available." I guess it is some background mechanics that will enable this option, since you had no reason to create "brand new" xml resource file this is not available yet. This option just let you use Android XML template when creating new resource file

Ok, cool. Well, I got everything to go, and I setup the Hello World application like the guide says (our setup menu's were very different, but I think everything worked ok).

But the emulator has been at this menu for a few minutes now without displaying Hello World.

OMG!!! NEVERMIND IT WENT!!! OH SWEEETTNESSSS!!!! :D So, quick question then, does everything except the display part of android all code the same as normal java for computers?


EDIT: even though it worked, in the Eclipse Console it display this in red.

[2011-10-26 11:17:36 - HellowAndroid] Failed to install HellowAndroid.apk on device 'emulator-5554!
[2011-10-26 11:17:36 - HellowAndroid] (null)
[2011-10-26 11:17:36 - HellowAndroid] Failed to install HellowAndroid.apk on device 'emulator-5554': EOF
[2011-10-26 11:17:36 - HellowAndroid] com.android.ddmlib.InstallException: EOF
[2011-10-26 11:17:36 - HellowAndroid] Launch canceled!

Here is my code, if it matters.

package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HellowAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android");
        setContentView(tv);
    }
}

Android emulator is little slow for start, so what you can do is have emulator running and minimize it. Then when your application successfully compile and you attempt to run it, IDE doesn't have to wait for emulator start and can immediately deploy your application. If you added ANDROID_HOME with links to tools and platform-tools directories to your PATH you can use following commands:
- to list all available avd devices android list avd sample output

Available Android Virtual Devices:
    Name: 2.3.3
    Path: /Users/peter/.android/avd/2.3.3.avd
  Target: Android 2.3.3 (API level 10)
     ABI: armeabi
    Skin: WVGA800
  Sdcard: 9M

- to run specific emulator by name emulator -avd 2.3.3 or shorthand emulator @2.3.3 where to 2.3.3 is the name of avd that you got listed from previous command

@aanders5 did you resolved your problem or still having issues? In worst case scenario I can download Eclipse and make sample of project for you

Yes the emulator worked, but in my previous post I mentioned the error that appeared in the console.

Should I just ignore it, since the emulator worked?

This should be fine, these messages you would see if deployment is done in certain time-frame. One of the reasons why I suggested to start emulator before it instead of waiting for IDE to get through whole process on its own

Okay I shall do that. Do you have any suggested tutorials on beginner android programs for people who are familiar with Java already?

At the moment I'm reading Pro Android 3 book

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.