Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android.App.Activity - package does not exist

I got an andorid project files that are supposed to compile correctly.

I installed the latest eclipse and Andriod ADT plugins.

I then imported the project and right clicked build.xml to run as ANT build. but I got erors on some basic code which I am sure is originating from my misconfigured setup.

I also tried to run it using ANT from the command line. both times I got the same type of errors

What is wrong ?

    Buildfile: /Users/admin/Downloads/moshe-5/build.xml
    init:
    process.annotations:
        [javac] Compiling 9 source files to /Users/admin/Downloads/moshe-5/build/classes
        [javac] /Users/admin/Downloads/moshe-5/src/ti/moshe/CustomAdapter.java:7: package android.app does not exist
        [javac] import android.app.Activity;
        [javac]                   ^
        [javac] /Users/admin/Downloads/moshe-5/src/ti/moshe/CustomAdapter.java:8: package android.content does not exist
        [javac] import android.content.Context;
        [javac]                       ^
        [javac] /Users/admin/Downloads/moshe-5/src/ti/moshe/CustomAdapter.java:9: package android.graphics does not exist
        [javac] import android.graphics.Color;
like image 865
Moshe Marciano Avatar asked Aug 31 '11 21:08

Moshe Marciano


2 Answers

In my case, it was due to the problem that I didn't have a default.properties file with the target field in it.

I had to manually create the file and put

target=android-9

Or other Android target version.

If you run

ant -v

with your build command, you'll probably see this line

Property "target" has not been set

and

[property] Unable to find property file: /PATH_TO/default.properties

Those messages are enough hints.

Hope this solves your problem too.

like image 189
kakyo Avatar answered Nov 15 '22 18:11

kakyo


It is not finding the android packages. IN the build step you should include android.jar corresponding to the android version you want to port to.

like image 1
potter Avatar answered Nov 15 '22 18:11

potter