I have updated today to the latest SDKTools, r21 and the projects are no longer packed correctly.
I am using for instance ActionBarSherlock as a library project, and when I run the application I get the following error :
java.lang.NoClassDefFoundError: com.actionbarsherlock.R$styleable
I have reverted back to r20 and it works again.
Did anything changed, and we should add different the library projects? I can't see something like this in the Release General Notes.
Yeh, it is ADT r21 causing it.
http://tools.android.com/download/adt-21-preview#TOC-New-in-ADT-21-Preview-5
The R classes for library projects are generated with only the IDs needed by the libraries, reducing the risk of hitting dex files limits for fields and methods.
You need to clean up the bin folder in the library project manually.
You can check the update on Tor Norbye google+ page
https://plus.google.com/116539451797396019960/posts/KVax2483Erk
Same problem but i have fixed it.
What i did:
Project / Clean / Build on all library projects
Removed the library projects and readded it on the android project
Android Tools / Fix Project Properties on the android project
Project / Clean / Build on the android project
Hope this helps and is also working for you.
Related
When I once built some simple project, Eclipse automatically generated appcompat_v7 library project in my workspace and include it in dependency list for my original project. Meanwhile, I downloaded new support library (via SDK manager) few times. Then I tried to built again the same project, but this time in dependency section, I manually removed appcompat_v7 and added project generated by successful built of Android-SDK\extras\android\support\v7\appcompat library project. This time I faced few build errors in original project, most of them being unable to find resources that match name "TextAppearance.AppCompat. ..." as parent style of some style tag in res\values\styles.xml (of original project). What am I missing ?
Eclipse handles appcompat with many problems. You always must:
Have a copy of appcompat library loaded into your workspace to import it in your project as library
Use the same support library version in your project and in the appcompat library. If you update the support library, update it manually in the appcompat and your project. Right button click over appcompat/project, Android Tools -> Add Support Library.
If you have style compile problems with appcompat library, use compileSdkVersion = 23, targetSdkVersion = 22
Finally, I will recommend to migrate to Android Studio too, much easier and much cleaner.
Later, I made a copy of Android-SDK\extras\android\support\v7\appcompat library project into my workspace (check box when making "new Android project form existing code") and original project compiles well. I considered as better practice not to copy appcompat, but rather to work through reference to it. That way I would have valid link to new version, when I upgrade support library over time. However it appeared as better move to make a copy.
Using Eclipse, is possible to generate an Android project using multidex for creating multiple
dex files? Searching over the net I found how to do that using gradle but nothing about to use that on
Eclipse without gradle
It looks like ADT's ant-tasks project is no longer maintained (it resides under 'legacy' folder).
So if you can't migrate to Gradle, you can edit the DexExecTask manually. You'll have of course to rebuild the project locally..
[Edit - 10/25/2014] maven-android-plugin does support multi-dex. However, it currently has a small issue: secondary dex files placed in wrong location. This pull request strives to fix that, so stay tuned! (Fixed in 4.0.0)
I have an Android project which uses the following library projects along with using the Android Support v4:
ActionBarSherlock
SlideMenuLib
Facebook
Google Play services
My project is working fine in eclipse and im able to launch the porject directly from the IDE but when I try to import and run the same project in IntelliJ (13.0.2), it gives me the following error
Android Dex: [Splash] com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
I know from the error that somehow IntelliJ is picking up the Supportv4 library multiple times from all the three places but any attempt to play around with the Support library imports, the project stops compiling saying com.android.support.v4 is missing in both Eclipse and Intellij.
Fixed the problem. Thanks to the solution found here: Intellij: android-support-v4.jar in included in actionBarSherlock and Project => IllegalArgumentException
I changed the scope of the support library in ActionbarSherlock and SlideMenuLib to 'provided' and that did the trick.
You have problems with your imports probably your project are using the same two libraries (older and new) and do not know with one should be used.
Check your Libs files, lib-project and references.
Try to: build path -> Order and Export, Uncheck the jar that is the same that the imported library uses.
Today, I upgraded ADT to version 22. After that, my projet wouldn't compile resources at all. My "gen" folder was empty and as such all my java files that require "R" wouldn't compile.
After a few non-full time hours, I restarted the "Android SDK Manager" and this time, I noticed these:
- "Android SDK Platform Tools" (upgrade)
- "Android SDK built-tools" (new)
After installing those, I was finally able to fully compile my project.
ADT22 use Android Private Libraries show project/libs'jar, add Exported feature, if you wannt reference library projects' private libraries, you must check the Exported
https://plus.google.com/photos/117122118961369445953/albums/5878509263473846433/5878509268379848162?authkey=CL3Frb-S_qj-fQ
If you are using some libraries or/and dependencies with other projects, you may also experience errors at execution time. In my case I had problems with Sherlock "Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr" and with some other jar file I am using "VFY: unable to find class referenced in signature" In that case, you must go to project properties, Java Build Path section, and remove Android Dependencies and Android Private Libraries, both in the main project and also in the dependent projects like for example Sherlock. After that you perform Clean on all projects. Everything should be restored. That worked for me, after a hard battle!
Yesterday I updated adt to v 21. Today, after minor corrections I rebuild and start project, but it crashes. In my project i use few library progects. ActionbarSherlock is one of them. Logcat says "java.lang.NoClassDefFoundError: com.actionbarsherlock.R$styleable at..."
The solution in my case was different though.
We need to make sure that in the library projects there aren't projects with the same package name.
If 2 library projects have the same package name, the build process will not generate R for any of them. Changing the package name of one of them (so both libraries have different package names) fixed the issue.
After few minutes of looking to logcat and head scratching i noticed, that R classes for library projects hasn't been generated in my project /gen folder. Why? It's a secret for me.
I just rebuilded library projects, than my - it solves the problem.
From adt release notes:
Updated the build to generate R resource classes for library projects with only the IDs needed by the libraries, reducing the risk of hitting DEX file limits for fields and methods.
It seems adt just ignore library projects build under the version prior v21