Does a Library Project require a package name in its AndroidManifest.xml? - android

I am having this weird problem where everything seems to work as expected but Eclipse's Console keeps issuing a Could not find Library.apk! error.
Since I have exhausted all possible "voodoo" tricks, I am now thinking perhaps the cause for that error message is that by specifying a package name for the Library project, Eclipse expects and APK?
The documentation on Library Projects in developer.android.com is very short and doesn't explain all the issues that I had to go through in order to make the conversion to library project based application work.
Does a Library Project require a package name in its AndroidManifest.xml?
If the answer is yes, why does Eclipse complain about not finding an APK when there shouldn't be any APK?

the issue you are having is connected to either the project .classpath or the .project file each located on the top level of your project directory. remove the lib from the project build path, erase the things in there connected to your library and add the build path references again.

Related

Trying to add facebooksdk.jar file to my project

I have installed facebookSDK and the sample apps. The sample apps all copilr and run fine.
I tried to make my own app. The only thing I did was creat a new android project, test it, runs fine. Then I added the facebooksdk jar file. Now my project no longer runs and I get a error that says
“jar miss match fix your dependencies”
The jar file seed to load in correctly, if I click on android dependences I see
Facebooksdk.jar ../programming/facebooksdk/……
I tried to see what was different from my project ans facebook's sample code.
Under android dependencies it had the same line I had Facebooksdk.jar ../programming/facebooksdk/……
And also had another jar file called android-suppert-v4-.jar that I do not have.
Other then that both the sample code and my test project seem to be the same.
there is a jar that exists both in the facebook sdk project and in yours.
This is caused by having a duplicate jar -- a .jar file of the same name that appears in both projects, but is not the exact same file. In this case, it is probably android.support.v4.jar, since Facebook uses it, and your project likely does too.
Check your dependencies carefully (and check your assets, bin, etc. folders) for the android support library in your own project -- even if you didn't add it yourself, the dependency could have been added by default, especially if you used the wizards provided with ADT for eclipse.

Include cwac-loaderex library in Android Eclipse project

I'm trying to use the cwac-loaderex library in my Android application. I cloned the repository and have imported the included project into my Eclipse project.
At this point I don't have any compilation errors in Eclipse, but when I try to run the application in the emulator I get:
03-23 20:34:16.895: E/dalvikvm(652): Could not find class 'com.commonsware.cwac.loaderex.SQLiteCursorLoader', referenced from method com.alwaysorderdessert.AlwaysOrderDessertActivity.onCreateLoader
How do I make sure that these external dependencies are loaded along with my application in the emulator and are also (by extension?) included in my distributed .apk?
Thanks!
Update
I have added the .jar file to my project and included in the build path, so now my project explorer window looks like the following:
However, I'm still getting the same error in the emulator. Any ideas?
Thanks again.
Update 2
After a bit of Googling and thanks to this SO answer I found that I just needed to check off the .jar file in the Java Build Path > Order and Exports tab.
Update 3
As was pointed out by the comment in the answer below, I should have copied the .jar file to the libs/ directory rather than lib/. This makes the other changes unnecessary (i.e., adding the .jar to the build path, selecting it for export). What a difference a letter makes!
Put the JAR in your libs/ directory, and that should be sufficient.
I noticed that my README was out of date, telling you to add it to your Eclipse build path. That was correct a year-and-change ago but is no longer needed and may contribute to your problems. Hence, if you manually adjusted your build path, undo that. I apologize for the stale instructions.

Why Eclipse Can't Write Resource

Eclipse CAN"T SIGN MY APP! But old version works fine.It just shows warnings below, is this a bug in juno version?
can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [ARMPlugin.jar:META-INF/MANIFEST.MF])
...
Look through you src folders, and see if there is an unneeded META-INF folder. Delete this and it should work.
For more information on this see below
http://jira.codehaus.org/browse/MNGECLIPSE-994
-injars android-support-v4.jar
-injars library.jar(!META-INF/MANIFEST.MF)
injars is NEEDED, But I don't understand why old eclipse don't need this.
Edit:
No, It has nothing to do with "injar##!!#...". I updated ADT, Eclipse. All Problem is gone.
(p.s.Eclipse Juno == Junk & Ugly :)
EDIT:
FInally, I found: It is not compatible with Astrill(VPN), I force closed astrill process and problems gone.
I had the same error with the latest version of Eclipse ADT and android SDK (Versions 23.07.2013) proguard 4.7.
My workspace had two projects: my App and Google Play License. I noticed that the folder "lib" of my App was containing the JAR file that caused the error of duplication. I do not know where or why Eclipse put this file, but theoretically it was not necessary, as part of the standard Android RunTime, and being required to run Google Play License, the easier it was to directly reference a project to another.
Managed to solve by doing the following:
I deleted the JAR that caused the error Lib folder.
I clicked on Project Clean to clean the exits.
In Project Properties, References, I checked Google Project License as direct reference.
I did rebuid main project, my App
When exporting with proguard no more errors occurred.
I can only assume that the reference of the folder Lib conflicted with the reference from Android standard runtime, and that proguard interpreted the two in sequence, rather than doing a merge, resulting in doubling.

Paypal Mobile Express Checkout Library sample app gives me NoClassDefFoundError Exception

I'm testing the sample app for Mobile Express Checkout Library with Android.
I'm getting java.lang.NoClassDefFoundError: com.paypal.android.pizza.ResultDelegate
The error is on this Pizza.java line: PayPal.fetchDeviceReferenceTokenWithAppID(this, appID, server, new ResultDelegate());
I'm confused, i didnt find any info about that error on google, and also on the faq on paypal and x.com, so i don't know how to solve it.
I simply opened the sample code project and executed it.
This is the link to the project and the library: https://www.x.com/sites/default/files/PayPal_MECL_1.0_Android-Developer-Package_0.zip
There are only three reasons you will ever get this error:
The class genuinely doesn't exist. If you are using code from an official example and getting this, make sure you have the latest build of the library
You have not added the jar to your build path. To fix this, right click on the jar in Eclipse, and do Build Path ► Add to Build Path.
Your jar is not in the /libs folder. This happens when you have added the jar to the build path, but newer versions of ADT need it to be in /libs. Put it there and it will automatically be added to the build path. If it isn't, try doing a Clean build via ant clean or Project ► Clean in eclipse.
Mostly, such errors occur because newer versions of the ADT require all external jars to be in the libs folder.
By looking at the project you linked to, I can see the paypal jar in the project root. Instead, try moving it into a /libs folder. This should solve your problem.
I think you have not exported library jar from the configure build path section of eclipse.
create libs directory in project's directory and add move PayPal_MECL.jar to /libs. goto project properties and remove existing PayPal_MECL entry from libraries

Unable to execute dex: Multiple dex files define Lcom/.... yet again

I've been searching around and there are quite a few posts relating to this issue, but there doesn't seem to be a definitive solution (eg Error when building apk - "Multiple dex files define Lcom/google/ads/Ad")
I've tried cleaning/updating/restarting eclipse - all of the things mentioned in other posts.
My project builds and I can run it on a device. But when I try and export a signed apk I get the error.
I don't get the error with other projects - all of which worked before updating adt etc but for some reason a particular project won't export...
As I say I can build the project in eclipse and run/debug it - I just can't export it.
The root cause of the problem was that one of the library was using nineoldandroid library as a jar stored in the ./libs dir , while another project was using nineoldandroid by referencing it
I was running into this issue. My situation was my application project was referencing a library project. Both were including the same external library (both use the library). Once I removed the reference to the external reference in the application project, the error went away. For me, this seemed to be that linking in the library was causing duplicate symbols, which was generating the "Multiple dex file" errors. Just a guess on my part. But, reading the above comments and other posts eventually lead me to see that I was including the library twice.
Check your build path. It is likely that you toggled 2 packages that are importing the same library (for me it was Google API that needed to be untoggled then retoggled)
in my case.. though the librari is not loaded in project.properties. it return "multiple dex bla bla bla.." I simply remove the library. and the problem solved
[Solution that worked in my case]
Right click project -> Build Path -> Configure Build Path -> Source -> Remove libCocos2dx
Was somehow building these libraries twice (since it's also included in Libraries tab)

Categories

Resources