Compiling Hello World

I'm working from a simple "hello world" tutorial and then modify it into the app I want. I started out with a hello world app added a button and now I'm tryin to respond to button events, etc.

But when I compile I'm getting the error: "package andriod.widget does not exist \n import andriod.widget.Button;"

The code is

package com.luke.bowls;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import andriod.widget.Button;

public class Bowls extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
                final Button button = (Button)findViewById(R.id.android_button);
                button.setOnClickListener(new OnClickListener() {
                    public void onClick(View v) {
                        // Perform action on clicks
                    }
                });
    }
}

It looks like a library reference problem but most of build code is hidden from me so I have no idea what to do to fix it.


Asked by: Sydney221 | Posted: 25-01-2022






Answer 1

You've mis-spelt android...

Answered by: Owen747 | Posted: 26-02-2022



Answer 2

if you use Eclipse, you should press Ctrl+Shift+O to automatically import the needed libraries instead of manually typing it :)

Answered by: Lana107 | Posted: 26-02-2022



Answer 3

maud-dib, I've sometimes had trouble downloading the eclipse plugin, but have always gotten it to work by manually downloading the plugin zip file and installing it in eclipse as local/archive plugin.

Answered by: Anna846 | Posted: 26-02-2022



Similar questions

Compiling Android scource code on ubuntu 9.10

I have downloaded the android source code (1.5 Gb and appx. 5 Gb after extracting).My intention is to compile this. 1) Do i need a toolchain for arm ..if yes which one will be suitable. 2) to run simulator and to be able to debug on workstation do i need to have any specific PC -linux toolchain .


gcc - Internal compiler error when compiling native Android code

Currently I am trying to compile native code for Android. The code is from the OpenCV port for Android. I pasted all the code correctly in my project and edited my make files accordingly. When I set android:debuggable to false everything works fine and I get my native library. When I try while android:debuggable is set to true I get an error. Here is a part of the log: Compile++ thumb: cxcore <= AR_Still...


android - Resource Problem in 1.5 when compiling against 2.2

If I compile my app with the Android 2.2 SDK target, it will not run on Android 1.5. If I compile with 2.1, it works fine. The problem seems to be in finding some of my resource files. Here's the stack dump: 09-06 11:22:15.387 W/ResourceType( 2702): Failure getting entry for 0x7f020004 (t=1 e=4) in package 0: 0xffffffb5 09-06 11:22:15.397 W/System.err( 2702): android.view.InflateException: Binary XML file l...


java - "cannot find symbol" when compiling with Ant

I need to generate an apk file using an Ant script, but I'm having problems with the compile target. To automatically generate the Ant script, I've used the Android tool with the command android update project. The problem is that this project depends on another project, so I need to use a custom compile task. For that reason, I've overridden that target: I've copied the compiled task from ant_ru...


java - I have my android app compiling in an emulator, now what?

I going through a simple tutorial to create a very small android app in eclipse. The tutorial is here: http://mobile.tutsplus.com/tutorials/android/android-sdk-development/. Now that I have it compiling, what should I do to get it on my phone? Do I need to export the app to some sort of exe? can i just copy and paste ...


android - C code not compiling correctly

I wrote a simple loop to aid in billboarding that will check if a pixel is white. if so, it will set it to 100% transparency. i wrote it in native code because the java equivalent of this loop took 19 seconds to run for a 256x256 bitmap, too slow. when compiling: #include "org_me_renderscene_Billboard.h" #include <stdio.h> #include <stdlib.h> JNIEXPORT jintArray JNICALL Java_org_me_r...


android - Compiling and running ApiDemos

I'm trying to compile Google's ApiDemos that come with the Android SDK. But I just CANT GET IT TO RUN! It makes me crazy already!! When I create a new project in Eclipse based on the sample (target 1.5 or 1.6) and try to compile and run, I get almost a thousand errors. Not what I'd expect from a tutorial app! Description Resource Path Location Type IRemoteService cannot be resolved RemoteServiceBind...


java - Android SDK not compiling apps correctly

It seems that the Android SDK doesn't compile my android app correctly. After building an app, I sometimes get seemingly random exceptions. The error goes away if I comment out the offending code, rebuild, uncomment the code, then rebuild again. For instance, this code gave me a NullPointerException: playButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { star...


java - a compiling issue using the Android virtual device

I have a question about the Android virtual device(avd)... as what you already know, that you can test your android application through avd in eclipse, and i'm getting a boring repeted thing with that. each time I want to test my application and when I make a small change to my application, I have to run the avd again and wait for a long time till the application run(switch the device on and wait for the system to ...


Compiling android Kernel

I have been in phase of compiling android kernel to install module on emulator. But i am stuck with horrible error. Here is how I am compiling the code: >> PATH=$PATH:/home/user/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- >> make CROSS_COMPILE=arm-eabi- ARCH=arm ============================================ PLATFORM_VERSION_CODENAME=AOSP PLATFORM_VERSION=AOSP TARGET_PRO...






Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top