Android :: Specifying Android Project Dependencies (in Eclipse)
Feb 21, 2009
I have two Android projects, a 'library project' containing a custom layout, and an 'application project' containing an application which uses the layout. Everything seems to build and execute fine, except that the visual layout editor throws a ClassNotFoundException (which I assume is a bug in the plug-in), but when I try to start to make use of the attributes I defined for the custom layout in the xml, the build fails. That is; this works:
<?xml version="1.0" encoding="utf-8"?>
<se.fnord.android.layout.PredicateLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="asdfasdf" />
</se.fnord.android.layout.PredicateLayout>
Whereas this does not:
<?xml version="1.0" encoding="utf-8"?>
<se.fnord.android.layout.PredicateLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fnord="http://schemas.android.com/apk/res/se.fnord.android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView fnord:layout_horizontalSpacing="1px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="asdfasdf"/>
</se.fnord.android.layout.PredicateLayout>
The build fails with a message from aapt:
ERROR No resource identifier found for attribute
'layout_horizontalSpacing' in package 'se.fnord.android'
The resource identifier does exist in the R-file and attrs.xml contained the library project, and if I put the layout code and resources directly in the application project everything works fine. The layout_horizontalSpacing attribute (and layout_verticalSpacing) is a custom attribute used in the PredicateLayout.LayoutParam class to specify the distance to the next widget. So far I've tried the standard eclipse ways by specifying project references and build path project dependencies. I was also told to try the <uses-library> tag in the application manifest, which did not help.
So, what do I need to do for the references in the xml-file to work? I don't know if it's relevant, but the 'library' manifest looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="se.fnord.android" android:versionCode="1" android:versionName="1.0.0">
</manifest>
The 'application' manifest like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="se.fnord.appname"
android:versionCode="1" android:versionName="1.0.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".AppName"
android:label="@string/app_name">
<intent-filter> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent filter> </activity> </application> </manifest>
'se.fnord.android.layout.PredicateLayout', btw, is a cleaned-up
Version of the layout posted at http://stackoverflow.com/questions/549451
View 2 Replies
Feb 21, 2009
I have two Android projects, a 'library project' containing a custom layout, and an 'application project' containing an application which uses the layout. Everything seems to build and execute fine, except that the visual layout editor throws a ClassNotFoundException (which I assume is a bug in the plug-in), but when I try to start to make use of the attributes I defined for the custom layout in the xml, the build fails. That is; this works:
<?xml version="1.0" encoding="utf-8"?>
<se.fnord.android.layout.PredicateLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="asdfasdf" />
</se.fnord.android.layout.PredicateLayout>
Whereas this does not:
<?xml version="1.0" encoding="utf-8"?>
<se.fnord.android.layout.PredicateLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fnord="http://schemas.android.com/apk/res/se.fnord.android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView fnord:layout_horizontalSpacing="1px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="asdfasdf"/>
</se.fnord.android.layout.PredicateLayout>
The build fails with a message from aapt:
ERROR No resource identifier found for attribute
'layout_horizontalSpacing' in package 'se.fnord.android'
The resource identifier does exist in the R-file and attrs.xml contained the library project, and if I put the layout code and resources directly in the application project everything works fine. The layout_horizontalSpacing attribute (and layout_verticalSpacing) is a custom attribute used in the PredicateLayout.LayoutParam class to specify the distance to the next widget. So far I've tried the standard eclipse ways by specifying project references and build path project dependencies. I was also told to try the <uses-library> tag in the application manifest, which did not help.
So, what do I need to do for the references in the xml-file to work? I don't know if it's relevant, but the 'library' manifest looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="se.fnord.android" android:versionCode="1" android:versionName="1.0.0">
</manifest>
The 'application' manifest like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="se.fnord.appname"
android:versionCode="1" android:versionName="1.0.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".AppName"
android:label="@string/app_name">
<intent-filter> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent filter> </activity> </application> </manifest>
'se.fnord.android.layout.PredicateLayout', btw, is a cleaned-up
Version of the layout posted at http://stackoverflow.com/questions/549451
View 5 Replies
View Related
Jun 7, 2010
Here is the situation.
I have a java project "LicenseGenerator" in eclipse that depends on commons-codec. I have therefore added the commons-codec jar file to the build path. I have Junit tests and everything is working fine. I have made a different project in the same workspace - which happens to be an Android project - that needs to use my LicenseGenerator classes. I added LicenseGenerator to the "projects" tab in the build path - the classes were recognized and I was able to use them.
Everything compiled and ran. However, when the part of the LicenseGenerator that used the commons-codec was called from my Android project I got the following error.
Could not find method
org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString,
Referenced from method
This basically tells me that the commons-codec was not packaged which the Android project, so I added the commons-codec to the android project as well but the same error appears.
View 2 Replies
View Related
Mar 21, 2010
Somethings I'll have an? .xml file selected when I compile a project, only to have a? .out.xml generated. Deleting the file doesn't clear the error, and Eclipse won't compile the project. It just reports that your project contains errors. The solution is to go to Project/Clean. This will clear the error in the project and allow it to compile.
View 6 Replies
View Related
Jan 3, 2010
I am new to Android Development. Actually i am iphone developer and i am learning android developer. I installed android and eclipse and i run one project successfully.Now problem is that after creating project, it doesn't appear in eclipse. So can anyone plz tell me that how can i open project into eclipse.
View 3 Replies
View Related
Jan 23, 2010
I'm completely new to Eclipse/Java/Android programming, so this might sound like a dumb question, but I can't open the project I was working on last week. it's the "HelloWorld" project.I'm very familiar with Visual Studio so I've been looking for something like a project file/solution or a way to open a directory in Exlipse, but I'm having no luck and am completely lost.
View 3 Replies
View Related
Aug 1, 2010
I tried to build test library and test app with latest ADT and Eclispe however Eclipse complains on each reference I made to library classes from my test app. This is what I did:
1. created Test Library Android project, marked it as "Library" (package name "test.library.lib") 2. created Test App project (package "test.library.app") and set it to use Test Library 3. Test Library got LibActivity class which simply referes to lib_main.xml layout 4. I defined that activity in Test App manifest file:.............
View 7 Replies
View Related
Oct 7, 2010
I have an android project that uses ant to build, is it possible to import this ant project in eclipse IDE?
update : There is an option to create project using ant build.xml in eclipse File->New->Project->Java->Java project from existing ant Buildfile. and if the build.xml file is selected it show error "Specified buildfile does not contain a javac task"
I guess javac is declared in this task
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs"/>
View 1 Replies
View Related
Sep 5, 2011
I wanted to start a new android project in Eclipse but it is not showing up when i choose file > new. I can't see any option to create android project there. And I also have android SDK too
View 9 Replies
View Related
May 2, 2014
I want to start a new android project in Eclipse but it is not showing up when i choose file > new. I also checked file > new > other. I can't see any option to create android project.
I'm completely new to Android development (but not to programming as such). I'm following the tutorial at Android Developers and got stumped immediately.
I've installed Eclipse and the Android SDK
adt-bundle-windows-x86_64-20131030
eclipse-standard-kepler-SR1-win32-x86_64
jdk-7u51-windows-x64.exe
View 1 Replies
View Related
Oct 29, 2012
I cant find "Android Project" when i go to eclipse>file>new>other>android>android project
"Android Project" is not there
While every person on youtube seems to have this
GT-I9100
View 6 Replies
View Related
Apr 17, 2009
How do you open an existing Eclipse Project?I don't see an open button or a way to load an existing project.
View 2 Replies
View Related
Aug 8, 2010
I forget to select the .java file before running an android app from Eclipse. I have a .xml selected, press Run and the projectfile breaks.
View 1 Replies
View Related
Oct 7, 2010
I would like to run a custom shell script upon clicking Build Project in Eclipse. I tried modifying the "compile" section in build.xml, but my script is not getting run. Invoking ant debug on the commandline works, however.
View 3 Replies
View Related
Mar 30, 2010
When I create a subfolder in the layout folder, and drag an xml file to it, the generated R file doesn't seem to show the subfolder. a) is there a way to change that b) is the file and file structure still picked up by SVN and c) so, if I do it that way, can I still just refer to the object using layout?
View 2 Replies
View Related
Sep 4, 2010
This is a two-part question about adding a third-party library (JAR) to an Android project in Eclipse. The first part of the question is, when I try to add a third-party JAR (library) to my Android project I first get the problem of Error parsing XML: unbound prefix
because I'm trying to use a class from that JAR (and need the prefix somehow defined). What's going on?Second, (after fixing that--the answer is given below), my application doesn't work on Android and I discover via the debugger (LogCat) that the class I'm attempting to consume doesn't exist.
Caused by:
java.lang.ClassNotFoundException:
com.github.droidfu.widgets.WebImageView...
Why, when I get no compilation or linker error in Eclipse, does it have this problem on the emulator? These two questions are rhetorical for I'm going to answer them myself below. Other posts in this forum creep up to the problem and elsewhere there is discussion, but I feel that I can be more explicitly helpful for the next guy to come along.
View 3 Replies
View Related
Sep 6, 2010
I am trying to create a library project, I've got things working up to the point of building the application that depends on the library, but installing the APK on the emulator always fails, because the shared library is not there. (The documentation indicates that the ADT would include the library in the APK of the dependant application, but this is clearly not happening.) BTW, I'm using the package name of my library project in the application's "uses library" tag. Is this correct? The documentation is completely silent on this subject. I've been banging my head against this for two days nowanyone has gotten a library project to actually work.
View 5 Replies
View Related
Jul 18, 2010
I'm clearly missing something simple, but after nearly an hour of trying to figure it out, I'm still stuck.
I have an external jar file containing classes I want to use in my project. No problem, right? I just followed the instructions at
That is, I used the Properties->Java Build Path->Libraries panel to add the jar to my project as a library. But it doesn't work. The external library is being included in the compilation classpath, so everything compiles correctly, but the external classes aren't actually getting included in the apk. When I try to run my app, it immediately crashes with a java.lang.NoClassDefFoundError. And looking at the apk, I see it's only 20K, whereas the external library jar is over 200K.
View 5 Replies
View Related
Feb 19, 2009
I've noticed that then I use "clean" from Eclipse project menu on my project I receive following error
[2009-02-19 09:55:02 - MyListView] no classfiles specified [2009-02-19 09:55:02 - MyListView] Conversion to Dalvik format failed with error 1
Project doesn't use any external jars and rather simple. If I uncheck build automatically and build it - it builds and runs just fine. I'm on MacOSX 10.5.6 and JDK 1.6.0_07. And latest android SDK ( android-sdk-mac_x86-1.1_r1.zip 79046151 bytes becf0f1763d61eedce15d2a903d6c1dd )
View 2 Replies
View Related
Sep 3, 2010
While compiling android project in eclipse 3.4.2, am getting The project cannot be built until the build path errors are resolved. I got a temporary solution from the blog http://www.scottdstrader.com/blog/ether_archives/000921.html
The resolution was to force a resave of the selected projects (and their .classpath files):
Open the project properties
Select Java Build Path > Libraries
Add a new, arbitrary library (to be deleted later) > OK
Wait for the workspace to refresh (or force a refresh of the project)
The error(s) will go away
Remove the dummy library
The only other references I could find were to make minor alterations of contents of the .classpath file.
View 1 Replies
View Related
Mar 20, 2010
Is there an example Hello Sound project for Android that will show how to create beep sounds of a variable tone and duration?
View 1 Replies
View Related
Sep 21, 2010
I had a project working in Eclipse completely, but after compiling it with ant in order to use Proguard to obfuscate the code the entire project fell apart. The project consists of a single package containing two main activities and 4 helper classes to handle databases and such. After using ant the activities work fine but Eclipse cannot find the helper classes and won't build. Even if I explicitly import the classes the error I get is
The import com.ts.routeTracking.DataHelper cannot be resolved while further mentions of the class get the error DataHelper cannot be resolved to a type. How can I get Eclipse and ant to work together?
View 1 Replies
View Related
Nov 10, 2010
I got the following error on error log,"conversion to dalvik format failed with error 1" How to resolve this issue?
View 3 Replies
View Related
Jul 2, 2009
I've tried checking out some projects to get them to run in eclipse -- for example twitta from:
http://twitta.googlecode.com/svn/trunk/
using subclipse plugin for eclipse.
It happens on other projects as well. When I checkout the project, it's not recognized as an android project (the src folder is not identified as a java source folder, etc.)
Anyway, when I try to run "convert to android project" from the context menu, I see
Problem Occurred
'Convert Project' has encountered a problem. twitta does not exist
The details text area is blank.
View 3 Replies
View Related
Aug 25, 2012
when i enter to eclipse new>other>android i have many options but not android project,i have insalled sdk and the plugins,what sould i do?
View 3 Replies
View Related
Sep 2, 2010
This happened to two programs of mine now and makes absolutely no sense. It usually comes about when I'm adding a resource file (in this case, a menu). In the package explorer: -the project name has a small red x, indicating that there is an error in one of its files -none of the sub-folders or files have an x or show any red highlights None of my code has errors! Ocasionally, I see this:
[2010-09-02 16:09:20 - FallDown] 'default' is not a best match for any device/locale combination.
[2010-09-02 16:09:20 - FallDown] Displaying it with 'Normal, Not Long, Landscape, Medium Density, Finger, Soft, Qwerty, Trackball, 480x320'
View 2 Replies
View Related
May 20, 2010
As part of the Android application I am developing in eclipse, I need to combine two packages from different projects into a single project. I tried copying the files in the package of the second project under the src folder of the first folder and copied other files required for second package into the res folder of the first project. But the auto-generated Java files i.e R.java doesn't get updated on copying. I tried right clicking on the project and clicking on Android Tools -> Fix Project Properties. But nothing changed.
View 2 Replies
View Related
Sep 13, 2010
I have a workspace with a few projects in it. App1 and App2 are Android applications. Common is an Android library project. App1 and App2 depend upon Common (linked via the Android tab). Common has some external dependencies, namely httpmime & apache-mime4j, which exist as jar files. For some reason, it appears that I need to add my mime jars to the build path of App1 and App2 for compilation to succeed. This seems really dumb. In normal Java, I would add Common to the build path of App1 and App2 and things would work. Is this expected that I have to add my jars to every Android application?
View 3 Replies
View Related
Dec 22, 2009
I am trying to build my first project for Android platform using the Eclipse IDE. The problem I am facing is that there is no option under the "Build Target" label in the New Android Project dialog box. And, hence I am not able to proceed beyond this dialog box (as the "Next" button is deactivated.) The online documentation says, "Under Target, select an Android target to be used as the project's Build Target. The Build Target specifies which Android platform you'd like your application built against." Could anyone tell me how to bring options under "Target" label. I am using Eclipse 3.5 (Galileo) and have installed latest Android SDK as well as all Android Platform components. The screenshot of the dialog box is available at : http://shared.pho.to/B2BF3343-D5DD-4ED4-F50F-468BEFC7698E
View 2 Replies
View Related
Apr 7, 2009
In the Android.mk, there are AAPT flags set as below. LOCAL_AAPT_FLAGS := -0 .dat.I'm wondering how to apply this AAPT flag in the eclipse project, so that the .dat raw data files will not be compressed in .apk?
View 3 Replies
View Related