I have several Android Projects marked as "Library Projects". I also have several Projects which use them, obviously.
The problem is, sometimes if I restart eclipse, all those Classes used from Library Projects are marked as "Not Found" and I can't quickfix that (using imports, etc.)
The only way I can fix it is right-click the project which includes library projects, remove all library projects, apply, then add them again. That is REALLY annoying, and I'd like to fix this permanently.
The Projects are using Android Library Projects and are not Library projects themselves. Eclipse Version: 3.7.1 Build id: M20110909-1335
Try upgrading your Eclipse ADT plugin to the 15.0.1 release that shipped earlier this week. After one last fixup using the steps you outlined above, I haven't had a recurrence of this problem.
Related
So,
as it seems that more and more people are using Android Studio i got curious and wanted to take a peek at it.
I have used Eclipse up until now and wanted to migrate a project to Android Studio. So i exported a gradle buildfile from within Eclipse, as android.developer.com suggested.
That worked fine, now i wanted to import that into Android Studio 0.3.2
When trying to import i got that Unable to import Eclipse project to Android Studio error. Now it is building.
But it got a new suprise, now before it is finished building, its asking specifically for an older Version of Gradle(1.6)... Ok, i can do that. Which leads me right back to the first error. So i tried this - Gradle version 1.6 is required. Current version is 1.8-20130730220035+0000
I can however create a New Project with Android Studio.
I've tried this for about an hour now and im getting sort of pissed, because it doesnt seem to know what it wants. Is it some sort of Bug or did i make some sort of mistake.
You're using a very old version of Android Studio. I'd recommend upgrading to 0.4.3. Versions later than 0.4.0 allow direct import of Eclipse projects instead of requiring you to do the cumbersome (and as you've seen problematic) export of projects from Eclipse; it's smarter about setting up the right plugin and Gradle versions. 0.4.3 has some important bugfixes over 0.4.0-0.4.2.
I've just migrated my projects. Here is two suggestions from my side.
Take the latest Android Studio.
Do not export / import projects from Eclipse. Most likely you are going to have errors in the project after this step. Starting from a clean project, which builds, will safe you a lot of time and avoid unnecessary frustration.
Create an empty Android Project in Android Studio. It must build without errors (⌘ F9). The start to enhance it using official Gradle Plugin user guide.
Create libraries folder and add all libraries in there one by one. Update build.gradle dependencies as mentioned in user guide. Make sure everything builds successfully.
After all libraries build you can copy-paste sources, resources and assets from Eclipse project to corresponding folders of Android Studio project. Make sure everything build as expected.
Now you can start with more advanced configuration like ProGuard configuration, release certificates etc.
I've done it in a couple of hours. Hope this helps you too.
I have been trying to export my eclipse project as a gradle build file to use it with Android Studio but I can't seem to make it work correctly.
When I click "Finish" nothing happens. If I repeatedly click it, I can see a progress bar that shows for a millisecond and then vanishes.
My ADT is version 22.3 (which is the latest) and I have tried all of the solutions I found on google as well.
Similar questions can be found here:
Eclipse Gradle export of Android project does nothing
Cannot generate gradle.build files from Eclipse
As you can see, there is not really a solid solution for this problem, but people wrote they created it manually. I don't know how to do so though.
Is there any solution for this problem that I haven't heard of? If not, how can I create the file manually?
Apparently, the current edition of the export-to-Gradle support in Eclipse cannot handle a project that is attached to an Android library project. In that case, you would need to (temporarily) detach the Android library project, export the main project, then modify build.gradle to use the library project (manually or via Android Studio).
Generating build.gradle files FIRST FOR ALL of the projects in my dependencies ONE AFTER ANOTHER worked for me.
I generated build.gradle (with export wizrd for facebook, play and whatever other projects I imported and used in my project).
For not trivial Android project you should do it manually.
For the latest build.gradle template for classic Android project check gh.c/N/n-1/b/m/o.n.e.e.g/docs/android/build.gradle.
You can continue to develop in Eclipse with ADT and run Gradle build using Nodeclipse/Enide Gradle for Eclipse
(marketplace)
Some screenshots for Gradle for Eclipse:
I'm writing an android app that uses both ActionBarSherlock and the Facebook Android SDK. Both these libraries provide android-support-v4.jar in their libs folder:
https://github.com/facebook/facebook-android-sdk/blob/master/libs/android-support-v4.jar
https://github.com/JakeWharton/ActionBarSherlock/blob/master/library/libs/android-support-v4.jar
However, in the head revision both versions of the support jar are different. This causes builds of my app using eclipse to fail.
I'm using both libraries by including them in the repo of my app as git submodules. One solution would be to fork one of these libraries, update the version of android-support-v4.jar in the fork, and point my submodule to the fork. While perhaps this is the right way to go, somehow this feels wrong.
I wanted to know if there were other alternatives before I use the above method. A number of popular Android libraries seem to use maven, is using maven a good solution for solving this problem, and a good idea for android apps in general?
First of all Delete android-support-v4.jar from All(yourProject,FacebookSDK etc. ).
Then follow below steps:
Right Click on Project -> Android Tools -> Add Support Library and The again Right Click on Project -> Android Tools -> Fix Project Properties do same on Facebook SDK and Other Libraries.
and Clean-Build all your projects(Facebook SDK,your Project and Libraries).You are Done.
I have implemented the new Facebook SDK 3.0 beta. The library project contains the Android support library v4. I also have the support library on my own proyect (a different version though). When I add the Facebook SDK as a library I get the next error on the console:
Jar mismatch! Fix your dependencies
Found 2 versions of android-support-v4.jar in the dependency list,
but not all the versions are identical (check is based on SHA-1 only at this time).
All versions of the libraries must be the same at this time.
I've tried to exclude the libs folder on the buildpath, but the error remains.
I have to put the same .jar in both places. Am I missing something here? The idea is to use the support library of my own project (to keep it updated).
It seems like the different projects are using two separate support libraries and therefore the checksum is different.
You must repeat this for both the Facebook SDK project and the app you are building.
What I do when I get this error is:
Right click the project.
Hover over Android Tools.
Click on "Add support library..."
Accept the downloading of the library.
This insures two things: a. you get the newest version of the support library from the Google sources, and b. you have the EXACT same library in all your projects.
Happy coding!
Simply delete the one in your project, remove it from the class path and try rebuild your project.
Installing the same version of support libraries via menus mentioned in the top answer is quite a good solution.
Although this sometimes didn't work for me (I think it has something to do with my Workspace folder being synced with Dropbox, so Eclipse won't overwrite files sometimes) so the approach I am using is to link the support library from the central place.
There are these JAR files inside your SDK folder (C:\Program Files (x86)\Android\android-sdk\extras\android\ on Windows for example) which is being updated when you run SDK manager, so you could just reference that one from both the Facebook (or any other library) and your projects. Since in the end, code from JAR files gets packed to your classes.dex. You don't even need the support library in the libs folder.
Also: If you use the Gradle build system and its dependency management or even Maven you will not have problems like these, but they require more time and knowledge to set-up correctly.
I've update to the latest SDK(4.0.x), tools(r16) and plugin(16.0.1) for Eclipse. I notice that now nearly all my projects in Eclipse have the library mentioned in this question's title showing as a referenced library in the Libraries tab of the Java build path. This is relatively new, though I'm not sure in which upgrade of the SDK it appeared.
It's not causing any problems but I'd quite like to know what its purpose is?
Interestingly it does not appear in projects which I also build using Ant from the command line. In these projects I send the Ant built binaries to a folder outside the Eclipse workspace. These projects naturally have a build.xml, an ant.properties and a proguard.cfg in the project root. This I suspect has something to do with why the com.android... library isn't in the build path. These projects build perfectly OK when built under Eclipse.
None of my projects are library projects.
Update: If I delete it from the Java build path, it appears to have no ill effects, in so far as the app still builds (even under Eclipse) and runs OK.
If you have any "Android Libraries" set in the Android section of the project then these are for linking in those libraries (the jars that the plugin will build)