DEX File error in Android (Eclipse) - android

My code is completely working fine, but when I am debugging (in order to check the values of my variables), it gives error that: DEX File throws java.io.exception I have added all the libraries to my build path too, still I am unable to fix the error. What could be the reason of it?

Related

Flutter - Getting 64K methods DEX Error from the Flutter project direcory but not from the Android project directory

After I added the next dependecies to my Flutter project:
cloud_firestore: ^0.9.0
firebase_auth: ^0.8.0+1
google_sign_in: ^4.0.0
I tried to run the app by clicking the run button in Android Studio but something weird is happening here:
Case 1: If I open the root Flutter project directory from Android Studio, Let's call it my_flutter_app directory, and click the run button I get the next error:
D8: Cannot fit requested classes in a single dex file (# methods:
68762 > 65536) java.lang.RuntimeException: java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Error while
merging dex archives: The number of method references in a .dex file
cannot exceed 64K.
Note: I perfectly understand what that error means and how to solve it, in fact if I add the known line to solve it:
multiDexEnabled true
With its respective dependencies the app is built fine and deployed to the device without getting any errors.
But the weird thing is the next:
Case 2: If I open the android directory of the same Flutter app from Android Studio, I mean my_flutter_app/android directory, and click the run button the app is built fine and deployed to the device without getting any errors. (Yes, without modifying any files, exactly the same scenario for both cases, without the multiDexEnabled true line)
So, I want to know what is happening here?
Why the Android project does not showing me that 64K methods DEX error while the Flutter project does?
I'm trying to keep my develop stuff as clean as possible so I'm hesitating to add that multiDexEnabled true line if is not necessary, so that's the reason of my question.
EDIT: Here are the contents for each directories:
This is the Flutter root directory view
This is the Android directory view
classes in a single dex file (# methods: 68762 > 65536)
This clearly tells you that your method counts are higher than the acceptable method count for a single dex file(64K).
So in order to fix that you should enable multidex in gradle file or remove unwanted or unused third party libs from the project.
If you ask why this is happening on Android Studio only? then the reason might be some default core classes which is loaded by Android Studio.

Android Studio resource linking failed and quick access to the problematic files

In old times of Android Studio, when I had compilation error and something was wrong resources I could quickly click on the error and was pointing me to the file. Now I’m getting error com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed but there is nothing to click that takes me quickly to the file to fix an error. Can I find these links somewhere?
You can find the issue on your project using the build report on Android Studio. You just need to switch between views:
This view will show the gradle build logs, and most likely will contain the resources issue.

proguardDebugAndroidTest Execution Failing with FileNotFoundException for mapping.txt with -dontobfuscate flag in proguard configuration

Even though our application does not use obfuscation, we are seeing a FileNotFoundException for mapping.txt when we try to run proguardDebugAndroidTest.
We do not see this error when generating normal debug or release builds. We only see this error when attempting to make an apk for instrumentation tests:
Error:Execution failed for task ':StubHub:proguardDebugAndroidTest'.
java.io.FileNotFoundException: /build/outputs/mapping/debug/mapping.txt (No such file or directory)
We are using Android Studio 1.2 and gradle plugin 1.1.3. Has anyone else run up against this issue and been able to troubleshoot it successfully? If so, how?
By creating the mapping.txt file in that path should be enough to solve the issue. It worked for me and is running just fine now
Digging up an old question because I struggled with this for quite some time. Namely for me "seeds.txt" was apparently missing. Jorge is right but if someone is getting this exception for any other proguard file, be sure that the proguard directory exists. I don't know why but Android Studio won't generate it on its own.
For instance if it says "FileNotFoundException" for app/proguard/seeds.txt, then create the directory "proguard" in the directory app.

How can I get cardslib into eclipse

hope someone knows better.
Since hours I try to include the cardslib - https://github.com/gabrielemariotti/cardslib, unfortunately without success.
When I want to including as it's described in the https://github.com/gabrielemariotti/cardslib/blob/master/doc/BUILD.md#reference-this-project-as-a-library-in-eclipse.
When I want to load the lib into the workspace the Error "An internal error occurred during: "Adjusting Android Project Classpath".
Source attachment path 'C:\Users\User\android-sdks\sources\android-14' for IClasspathEntry must be absolute" appears.
I never had such an error before. What causes it?
After pressing "OK" the lib gets into the workspace and "cardslib] Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 14" is shown on the console. So the lib is marked with an error.
After getting through the document (mark as lib etc. in properties) I still get some errors:
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
BuildConfig.java /cardslib/gen/it/gmariotti/cardslib/library/cards line 1 Java Problem
error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.
styles.xml /cardslib/res/values line 23 Android AAPT Problem
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project cardslib Unknown Java Problem
I asked google about it already but didn't find a match so I hope someone can help me out.
Thanks in advance.

Android error not visible

When I attempt to run my Android application I get the following message:
your project contains error(s), please fix them before running your application
All I did was to clean the application and everything went wrong.
Normally, you would see a red asterisk against the offending file and the corresponding line with the error. But in this case I get no such indication.
Screenshots:
Sounds like you have a syntax error in one of your XML files, or an invalid file name.
When you do a clean it deletes certain files, it would then automatically build, if you have syntax errors the R.java file won't be generated and you will have the above error.
you can check in android console(window->show view->console),it will give some more information,check it once,check your build path if your are import your project somewhere else and the project uses 3rd party libraries or you may have problems with your XML resources.
Found the source of my mysterious error.
It turns out it was a imported java class I had forgotten about which I wasn't using and caused the error to showup when I "cleaned" the project.
I visited the build path where I saw it had an associated error. I removed it and all was well.

Categories

Resources