compiled jar library project - Android Software Development

Hi all.
I need to do a close source library for my work.
I figured I could create a library project and then export all of its code into a compiled jar archive.
Then, when I need to use that library, I use the empty android library project for its resources and I import the jar file in the build path.
So far, it works when the main project that uses the library doesn't have its own resources.
But as soon as I add a resource (like icon.png) into the main project, the application fails to launch a library activity and I get this error : Unable to start activity ComponentInfo{...}: android.content.res.Resources$NotFoundException: File res/drawable/icon.png from xml type layout resource ID #0x7f020000
I really don't get it. What's the problem ?
Thank you for your help.

Related

html to XML parser

hello guys!
i'm going develop a application, that extract information to the pages HTML, and to do this, i think that its more simple do the parse of the html pages to the xml language an then get th spscific XML tree structure, to extrat more easilly the fields that i want.
Any One konws if exists applications for mobile to do that (the parse and the seek in the tree stucture) in open source.
And for desktop a cool open source html parser?
Thanks for the help.
Psyke

Problem when running XML file

I am just starting with Android Development and have a few minor problems.
First of all, sometimes I don't always know what packages to import. Is there a way to import them automatically? I am coding in Ecplise.
2nd, If, because I am not attentive, I hit the "Run" button but with an XML file opened. This results in making a another xml file name <filename>.out.xml that has errors. If I delete the file I still have a red x on my project folder. And when I try to run the actual java file it sais that the project contains error. The only solution is to delete the entire project and recreate it. But this is uncovinient to always recreate the project, recopy the entire code and everything. Does anyone know how to solve this problem? Thanks
Forgot to mention, the error that appears in the "problems" tab is this: Description
Unparsed aapt error(s)! Check the console for output.
And in the console i have this:
[2010-06-30 19:36:36 - Math Test] Error in an XML file: aborting build.
[2010-06-30 19:37:12 - Math Test] res\layout\main.xml:0: ERROR Resource entry main is already defined.
[2010-06-30 19:37:12 - Math Test] res\layout\main.out.xml:0: Originally defined here.
[2010-06-30 19:37:16 - Math Test] res\layout\main.xml:0: ERROR Resource entry main is already defined.
[2010-06-30 19:37:16 - Math Test] res\layout\main.out.xml:0: Originally defined here.
to import packages ctrl+shift+o
Thanks. Also, I managed to remove the error just by deleting it from the "Problems" tab and forcing a rebuild. Thanks.

NoClassDefFoundError

hi,
i' trying to use an external library in my android sourcecode, but i fail at executing after successful compiling with a "NoClassDefFoundError"
i set the CLASSPATH to the external JAR File i want to use, and imported that jar file as a library, but still the same error.
what is missing, or where am i wrong?
please help
Agassiz said:
i set the CLASSPATH to the external JAR File
Click to expand...
Click to collapse
And how do you do that? As far as I know Java does not have an API to modify CLASSPATH at runtime.
oh i forgot to mention, that i use Eclipse to code android apps
ok after adding a JAR file into my project (not a library - like i did before), the time to build the workspace takes a very long time... everytime i type ctrl+s for saving even one new character, the workspace is being rebuilt, that takes about 5 to 10 seconds... thats really annoying...
Agassiz said:
hi,
i' trying to use an external library in my android sourcecode, but i fail at executing after successful compiling with a "NoClassDefFoundError"
i set the CLASSPATH to the external JAR File i want to use, and imported that jar file as a library, but still the same error.
what is missing, or where am i wrong?
please help
Click to expand...
Click to collapse
Copy the jar you are using into a folder in your project, such as assets.
In eclipse:
right click on your project.
Go to properties.
Click on java build path.
Click on the libraries tab
Click add JAR
Select your JAR and press ok. press ok to exit the project properties.
Your application should now find the class you are looking for.
corruptor64 said:
Copy the jar you are using into a folder in your project, such as assets.
In eclipse:
right click on your project.
Go to properties.
Click on java build path.
Click on the libraries tab
Click add JAR
Select your JAR and press ok. press ok to exit the project properties.
Your application should now find the class you are looking for.
Click to expand...
Click to collapse
hey thanks a lot this worked out.
but eclipse is very slow now. if i remove the JAR file it runs fast like always... the jar file's size is just 3,6MB :/

Compiling my own Support library into JAR

(This is a repost from Stack Overflow, so if you prefer to earn points there see this question: http://stackoverflow.com/questions/17218475/build-android-support-library-into-jar )
We all know Android Support Library has bugs. Some of them trivial and not fixed for years. I need to fix a few of them, but... how do I compile ASL source into usable JAR? What I did until now - in Eclipse created a directory in which I've put all classes from support library source. I added android.jar to the project and it doesn't show any errors after this. Then I used "Export..." into jar, which finished with some warnings and a size very close to ariginal android-support-v13.jar. Unfortunately my Android application with this self-built library fails with lots of missing classes reported at runtime (meaning it compiles without a problem).

could not find class referenced from method

Hi all...
I made a java web app for restaurant recommendation. I created SOAP web services for accessing the server. Now I need to make android client for that web app and I want to use the web services I made. So... I go to my command prompt and type the following
Code:
wsimport -keep -s src <WSDL_URI>
which generates source files that I need to use in order to consume web services. I then go to my Android project, create package named "com.restaurec.services" (that's the name of the package that the source files are in), and simply copy the files there. Then I import the necessary libraries (javax.xml.bind.jar, javax.jws-3.0.1.jar, and jaxws-api-2.2.1.jar) as external jars and try to run the application.
Now, in run time log cat says: Could not find class 'com.restaurec.services.BlahBlah' referenced from method 'com.example.MainActivity.method.
and then the application crashes with NoClassDefFoundException
I also tried to put the libraries (javax.xml.bind.jar, javax.jws-3.0.1.jar, and jaxws-api-2.2.1.jar) in libs folder, but that did not work either.
I was also trying to Order and Export (by the way, I have no clue what these options do, so if anyone could explain I would appreciate it), but that did not do the magic also.
Any help is appreciated!
Thanks in advance!

Categories

Resources