Android - Multidex using Eclipse - android

Just started working in a new company that've been developing an app for some time now. They really like here using 3rd party open-source libraries and yesterday i got the dreadful message
Unable to execute dex: method ID not in [0, 0xffff]: 65536
Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
when tried to add facebook sdk. We are still working on eclipse (on mac) here and the last day i've been breaking my head on implementing the multidex solution as described here.
Since im not using gradle i had to workaround this problem and found a nice solution - Enable `--multi-dex` option in ant for Android.
The problem i'm having now is with executing build.xml ant script with the multidex additions. I cannot understand which target i need to execute by default, and whether i should do it everytime i want to launch the app from eclipse (just for debugging). i tried to execute the debug target but im getting the following message :
/Applications/adt-bundle-mac/sdk/tools/ant/build.xml:601: The following error occurred while executing this line:
/Applications/adt-bundle-mac/sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
/Applications/adt-bundle-mac/sdk/tools/ant/build.xml:698: null returned: 1
As you can see im kindda helpless here. i would really appreciate some guidance with the way of working with multidexed applications on eclipse. Thanks!

Related

how to solve java.lang.NoClassDefFoundError in Android Studio?

In order to solve this error in eclipse "Conversion to Dalvik format failed:Unable to execute dex: method ID not in [0, 0xffff]: 65536". I am trying to execute the same Android project in Android Studio, but unfortunately it does not have any error in compile and build to execute. After execution, while starting the activity. It gives java.lang.NoClassDefFoundError. Where the error occurs, Please provide the way to find or solve this problem?
You should make your application multi-dex. For more imformation:
https://developer.android.com/tools/building/multidex.html
https://developer.android.com/reference/android/support/multidex/MultiDexApplication.html
Once you've done that, if you still get NoClassDefFound, you should run the dexMainClasses script for classes that must be in the main classes.dex file:
http://blog.osom.info/2014/10/multi-dex-to-rescue-from-infamous-65536.html
http://blog.osom.info/2014/10/generating-main-dex-list-file.html

Too many methods in a project

I understand that this question was asked a lot, but hear me out.
Compilation of Android (debug) project through Eclipse (ecj) succeeds (apk is generated), but when the same code with the same libraries is compiled through ant (javac) I'm getting compilation error (dx stage).
java.lang.IllegalArgumentException: method ID not in [0, 0xffff]: 65536
The problem isn't the message itself but the lack of it while compiling the project through Eclipse.
Can someone explain why Eclipse succeeds and Ant fails?
Eclipse succeeds in building the project but the error is actually generated later - when you run the project. I think it's because this is when all the libraries and (related) projects are linked in one apk.
You may take a look at this great post

Conversion to Dalvik format failed in my console

I have one problem in my project Android. My project compile, but when I run the application, I've got this message "Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lbiz/source_code/base64Coder/Base64Coder;"
I've tryed to clean my project too, but nothing.
Can Anyone help me?
This is normally caused because you have 2 identical libraries added to your project.
Remove one of them and the problem will be resolved.

Unable to execute dex: wrapper was not properly loaded first

I can't run my project. I've download the project from here. When i'm going to run this project. It raises this error : -
[2011-11-02 06:22:04 - Dex Loader] Unable to execute dex: wrapper was not properly loaded first
[2011-11-02 06:22:04 - jberkel-sms-backup-plus-9a8489a] Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first
I just referred some links from google for this error. They told that clean the project using project > clean Am also tried this method. But, the same error will raise from here after. What can i do for this? Any help appreciated.
I'm also having this same problem once a time. Just Restart your Eclipse and run the project again. It'll clear. Hope this will help you.

Eclipse Android Project Error

Trying to run my Android App and Eclipse (in Windows 7) is throwing up an error. Yesterday I had no problem so I can't think what I could have done to caus eit. The error message is
**Your project contains error(s), please fix them before running your application.**
Well, I went to window->view->error log and I found this
Warning
While loading class "com.android.sdklib.internal.project.ProjectProperties", thread "Thread[main,6,main]" timed out waiting (5000ms) for thread "Thread[org.eclipse.jdt.internal.ui.text.JavaReconciler,1,main]" to finish starting bundle "com.android.ide.eclipse.adt_11.0.0.v201105251008-128486 [317]". To avoid deadlock, thread "Thread[main,6,main]" is proceeding but "com.android.sdklib.internal.project.ProjectProperties" may not be fully initialized.
org.osgi.framework.BundleException: State change in progress for bundle "reference:file:plugins/com.android.ide.eclipse.adt_11.0.0.v201105251008-128486.jar" by thread "org.eclipse.jdt.internal.ui.text.JavaReconciler".
at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1073)
I would like ot add that although the project itself is showing an error no source file or resource has an error.
SO far I have tried:
clean/build (several times)
close eclipse and reopen (several times)
shutdown computer and restart
Thanks in advance.
EDIT:
Tried again and got the following message in console:
[2011-08-14 00:40:47 - Dex Loader] Unable to execute dex: wrapper was not properly loaded first
[2011-08-14 00:40:47 - MyAppName] Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first
Don't know it cant convert to Dalvik format. The SDK is in the build path.
After much stress and pain and me almost throwing my computer out the window I found the problem is in the debug.keystore file. Although Eclipse gave me no warning of this. After deleting the debug.keystore file I cleaned/build my project.
Eclipse gave the following error.
Re-installation failed due to different application signatures.
[2011-08-14 13:16:42 - MyApp] You must perform a full uninstall of the application.
WARNING: This will remove the application data!
[2011-08-14 13:16:42 - MyApp] Please execute 'adb uninstall com.etc.etc' in a shell.
[2011-08-14 13:16:42 - MyApp] Launch canceled!
I didnt follow the advice but simply renamed my package. It works now. I'm not sure what to do with older packages that I have released onto the Market. It will be difficult to add new versions if I have to rename them to test them on the emulator/my phone.
feels to me something wrong with the SDK. Why dont you uninstall the current Android sdk and install a new version instead.
Right-click on your Project in Eclipse and choose Properties. Check in the Java Build Path that you have the Google API's in the Libraries tab. Check the references to them.

Categories

Resources