Android studio: Builded jar file not generating some class files - android

Hi i downloaded the vector chat application from this link and i
imported it as a superate project (By using java 1.7 sdk only it was
working).
As a superate project it's working perfectly then i imported (by
copying manually) this project to my personal project then i got some
error, by spending some time i resolved almost all errors but now i'm
getting the error as cannot resolve symbol RoomPreviewData.
This RoomPreviewData class file was generating in the jar file in
vector project (inside of build folder) but in my personal project
it's not generating the RoomPreviewData.
For understanding i'm attaching the images to this question. So, any
one please help me to solve this
Vector project image
Failure project image

Am I getting it right that you're building Matrix SDK artifact by yourself and then importing it into the project? If so, please validate build logs and also see if the file was actually packed into artifact (actually, you may even inspect it as an archive)
Alternatively, you can pull whole package's code from that link and then load it as is into the project

I don't think this was the exact answer, but i'm posting here because it may help others.
I changed the package name of vector project as my personal project (For changing package name fallow these steps)
Imported (Just copy and paste) my personal project into vector project
then everything working fine......

Related

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.

Built Android App with Jenkins including Library Projects

I have just set-up my local jenkins installation on my mac...
Now i have tried to create an ant built which builds my app as soon as i check-in a new change. The ant script is working great as long as i only use it in the project...
cd into the folder
ant release
It is able to find all library projects i'Ve included (ActionBarSherlock, ViewPagerIndicator, NineOldAndroids, HoloEveryWhere, PocketChange)
As soon as i put this on my jenkins installation everything breaks.
My main folder-organisation is like this:
Projects/Project
Projects/ProjectLibrarys/Library
Eclipse referes to those libraries like this: android.library.reference.2=../Project Librarys/ActionBarSherlock/library
I can't use absolute links (because i think they will fix the issue) but eclipse or ant doesn't like them.
I have really no idea how to fix it?
Will i have to edit the build.xml (i've added it into the folder ext/commonbuild/commonbuild.xml so i have the same android build file for all my projects)
If you need more code let me know.
Thanks in advance...
Ok i was able to solve my issue by adding a customproject.properties file with a seperate link for the build.
There is still one issue. It seems that ant doesn't use the customproject.properties for my library project i've added. This library project includes another library project and as soon as i build it has a wrong relative url.
Does someone know how to use the customproject.properties even for the project libraries?
As bluszcz mentioned, I checked out two modules and i was able to build my apk via Jenkins without having two project.properties or customproject.properties file.
On Jenkins Configure Screen, Under Source Code Management - Subversion Modules,
Give the url for your android project (say, SampleAndroidProject)
https://goxxx.com/svn/repository/projects/trunk/SampleAndroidProject
Provide local module directory as 'SampleAndroidProject'
Provide the svn url for your library project (say, google-play-services_lib)
https://goxxx.com/svn/repository/projects/trunk/google-play-services_lib
Provide local module directory as 'google-play-services_lib'
Save and build again.

Android - Adding JAR File to eclipse (hotpotato API)

I'm having this problem, and tried googling and doing tutorials in eclipse. But, it wasnt really helpful for me to use this .jar file in my project.
Source: https://github.com/brunodecarvalho/hotpotato
To be specific, I downloaded this jar file , added it to my project successfully by copying the jar file into my source folder , then added it by doing(Properties->Add Jars->And added it). Also i did a Project -> Clean.
Then once I start coding as they have shown in the examples, it gives me errors, which proves that the Adding of Jar file was not successful.
I tried in different eclipse workspaces but still no luck.
If I explain what I'm trying to do here, I'm working on a Android Download Manager Project. What I need to do is to create a pipeling connection to the request URL so that I can download the packets parallel.
Please help me find my mistake. Thanks for your time!
You can try the following:
Remove the jar from the buildpath - and make a folder called libs underneath the root of the project, at the same level as src / bin / etc.
Then put your lib in there, build path issues may then arise if you are in Eclipse but i believe everything should auto resolve from there.
In the past I have put the jar in the libs folder and additionally added it to the build path from there.
Does it error in the IDE, or at runtime?
Not all Java libraries are compatible with Android. Do what RenegadeAndy wrote here, and if that doesn't work, the lib might really be incompatible with Android.
Remember, Android is not a real Java implementation.

Converting Eclipse Java Project to Android Project

OK, first off, I HAVE read both Convert java project into android project on Eclipse and Convert java project into android project on Eclipse
but my problem here is a little different, and none of those solutions listed work at all. This is with Eclipse Classic 3.7.2
Basically, I'm doing a bit of collaborative work on a project that comes from subversion. I've been tasked with creating an Android branch. So I grab the eclipse project from subversion, and then it should be easy to change this project to Android, right? Except it seems to be anything but. I have tried all that has been listed. There is no convert button. If I try to create a new Android project from existing source, it says 'Eclipse project already found!', if I delete the .project it demands a manifest file, I create another android project and just copy the manifest file over, no go. Everything compiles, but then I get a lot of errors in logcat. The first one being "Failed to load properties file for project". I copy over the properties file, and I still get the error. Same thing occurs if I modify the nature in .project .
I just want this to convert this to an android project, get rid of any compile time errors that might occur due to a mismatch of libraries between Java and Dalvik, then upload it as a branch. I could potentially create a new java project and copy over source, but then I'm not entirely sure how I can upload that to subversion as a branch, since I'm not modifying the stuff I got from the repository...
Thanks for any help!
EDIT: In response to one supplied answer to create a new android project, and use existing source, this simply doesn't work. I point it to the directory of the Java non-android project, it tells me that a project already exists in that directory. I delete the .project file, then I get the error "Build path contains duplicate entry 'src' for project com_android_pdstore.
You can try creating a new android project and choose 'create project from existing source', I had this type of problem once, and that was the solution.
Right Clicking on the Project and then Android Tools ,click Fix Project Properties, could be an incompatible API build.

Android: Unable to include facebook sdk library project

I am working with Android API 17 on eclipse Indigo. I have cloned the faccebook sdk from github and done the facebook library project set up using the source project provided in the fb sdk.
Now I'm trying to include this library project in my android demo project. I have added it under Project properties->Android->Library section. Im seeing green color tick mark infront of the added library.
Also, i have added the same in the Project properties->Java build path->Projects.
build is successful. but when i try to install on my AVD, im getting the error, E/AndroidRuntime(748): java.lang.NoClassDefFoundError: com.facebook.android.Facebook
Can anybody plz help me how to fix this issue.
---- EDIT ------
One more thing I have observed is, when i opened Project properties->Android window, the green tick mark is not displaying under Library section, instead I'm seeing red cross mark.
Any ideas?
Thanks,
Venkat Papana
Same thing happen for me also.. try below .. it will work..
A Best way to add External Jars to your Android Project or any Java project is:
Create a folder called libs into you project root folder
Copy your Jar files to the libs folder
Now right click on the Jar file and then select Build Path > Add to Build Path, this will create a folder called Refrenced Library into you project, and your are done
By do doing like this, whenever you transfer you project to other Computer, you will not miss your libraries which are being referenced to some space on your Hard drive.
(The facebooksdk.jar can be found at the facebook-sdk directory: <facebook-sdk>\facebook\bin)
i know this question is old But I thought that may be it can help someone.
Move the library project and the application on the same drive. Usually this is a bug in Eclipse.
I solved my problem by moving them in same drive on my computer.
You can Give it a try.
You need to make both project in same dictionary then include it using Project Properties -> Android-> Library.
This works fine.
You do not have to add this to the library project as this is not the library.
https://github.com/facebook/facebook-android-sdk is the help of the project ad the sample code for the including the project in our code. Just you need to create the app ID for the facebook by registering your api with it.
Hope this will help you in your project.
Resolved by copying the com.facebook.android source code to my project source.

Categories

Resources