Eclipse: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl - android

A similar question has been asked for Android Studio. But I am an eclipse user.
I am including the Facebook SDK in my project. After adding the SDK, when I run the program, I get the error
Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl
I tried cleaning and the error persists. Any ideas how to solve this issue? Again, I am using eclipse.

This really should be just a warning that won't stop your compilation. I believe by default it will use the most recent version of the file in the path of your project. Since the facebook API might be a version behind the recent released version included in your project, you can either remove your version in the project and rely on theirs, ignore the warning or update them so they both have the same version of the compatibility library.

Related

Program type already present: android.support.annotation.AnimRes

This problem happened to me after i updated to the latest version of Xamarin.Forms (4.6.0)
I get this error whenever i try to build my Android Projects in Visual Studio For Mac (8.5.4)
What i tried so far:
Using different versions of the Android Support libraries
Cleaning my NuGet Cache
Reinstalling the SDK
Cleaning, Rebuilding, Restarting VS (several times)
Oddly i managed to get it working for a few builds after changing my support library versions from 28.0.0.3 to 28.0.0.1 manually in the csproj file. However i tried this several times and it doesn't solve the problem.
The problem occurs if i create a fresh Xamarin.Forms project aswell.
Any advice appreciated, as this is starting to be frustrating.
I don't know if this will help, but you should migrate to AndroidX as soon as possible, nevertheless. Xamarin has migrated to them, starting from Forms 4.5
Here is some more information about the libraries - Introducing AndroidX for Xamarin
There is a special NuGet package for the migration - Xamarin.AndroidX.Migration. Also available is a built-in functionality in Visual Studio - here
What I can suggest is you try to migrate to AndroidX libraries, since the old support libraries won't be supported from now on, and you will surely encounter some issues if not like this one, then something else will pop-up in the future.

Unable to build project with both Firebase and Mapbox

I have created a location-based game using the Mapbox SDK in Unity 2018.2.1f1, and it has been able to build just fine. My goal was to add database functionality to my project by using Firebase, to store GPS coordinates online.
I followed the official tutorial for setting up Firebase in a Unity project. When this was completed, a window popped up saying "Resolving Android Dependencies", which took about half an hour.
Since then, I have been unable to build to my Android device. I receive 96 gradle build error, and the one at the top is:
> No toolchains found in the NDK toolchains folder for ABI with prefix:
mips64el-linux-android"
I reverted the project to its pre-Firebase version, and it was still unable to build, as if something in the Android build tools had been changed.
Next, I tried an entirely different version of Unity, and installed a fresh install of Unity 2019.2.9f1. I opted to use this version of Unity's in-build Android SDK and NDK. I reverted my project back to the last known working version (pre-Firebase), ported it to the new version of Unity, and completed a successful build to my device before moving on.
Then I followed the appropriate steps to add Firebase to my project again, and the same exact pop-up windows appeared in Unity, claiming that it detected "obsolete files" that it wished to delete (this time I said no), and then it performed the same "Resolving Android Dependencies" process.
Once this process was complete, I made no other changes, and tried to build again. It failed, and I received the same 96 gradle build errors. This confirms this error as repeatable on two different versions of Unity.
I believe this has something to do with conflicting dependencies between Mapbox and Firebase. Has anyone encountered this issue, or successfully been able to use these two things together in a project?
So, the baseline problem is that something is telling the Android build process to generate project files for the MIPS architecture. This architecture was removed from the official NDK in r17 (see this link for supported architectures). I'm not sure if Unity ever supported it, but it's not in the current version:
I do not know how MapBox is packaged and shipped, so I don't exactly know what postprocessing hooks might be conflicting between that and Firebase. I'll try to give you some steps forward though.
First, make sure you have the latest SDK from Firebase and MapBox. Also, when it asks to delete obsolete files, say yes. The Play Services Resolver should only prompt this for files that it tracks (and the Firebase plugin ships in a state where this is expected).
If that doesn't help, look for a mips folder included in your Unity project (probably something like libs/mips or jnilibs/mips). Hopefully deleting these will fix the issue.
If the above doesn't work or is non-actionable, try using a mainTemplate.gradle file:
If you follow the instructions I wrote up here to instruct the Play Services Resolver to patch your mainTemplate.gradle file:
You can double check your ABI filters directly in the file. By default it shows:
ndk {
abiFilters **ABIFILTERS**
}
to match what you've selected in Unity. But you can use this to double check that mips64 isn't included via some other process.
Unfortunately I don't know what else to suggest if neither of the above options work. In that case I'd suggest posting a bit more of the error you're getting. If you can reproduce the error you're having with one of the Firebase sample projects, you can file an issue on that issue tracker directly. Finally, if you don't get an answer here and you do think that it's Firebase related, you can contact the Firebase support as well.
I hope something in my post helps!
--Patrick

How to fix Android SDK buid tools version too low with terminal?

My english is not very good, thx for your reading :)
"The SDK Build Tools revision (23.0.1) is too low for project",this error always show when I reinstall some modules. I know this error is caused by gradle version.
Usually, I just click Android Studio error tip to fix this problem, just like the blow picture shows.
The error tip
And I know AS modify my modules code to the recommended version, but i don't know the inner process.
I know another way is using the highest sdk build tool verison to config the main project's gradle setting and make sub project to read the main project's instead of own. just like this way
But, I worry about this way may cause some compatibility problem in the future.
I think the best way is what AS do
So, I really want to know what Android Studio do, can I use some AS command and gradle command to fix this error automatically?
Or my worry about compatibility is wrong?

Android Library project organization

I have an Android Apps (A) project that depends on a Library project (B). The library project contains code as well as third-party jar files and some other jars that were exported from projects C and D. In Eclipse, I have project B specified as a library project.
However, when I connect my device and run project A (Run As -> Android Application), it crashes on the device and when I examine the LogCat output, there is a NoClassDefFoundError exception for one of the classes that exists in the jar files of project C.
When I unpack the B.jar file in Project B's bin folder, it does not contain anything else besides the META-INF/ folder with an empty MANIFEST.MF file. So this indicates that something seems to be going wrong someplace, but I'm unable to figure it out.
Could anybody help me with this issue?
Are you working with the latest ADT plugin and SDK revision? That is rev 22.x. If so there has been an important change to the dependency management.
Possible solution
For some reason the contents of the Order and Export tab has completely changed and you now have to export the Android Private Libraries from your library projects. See screenshot below:
More details
The tricky part of this change is that your project still compiles properly in Eclipse so you're not aware of any issues. Until you deploy the app on an emulator or device and you get the ClassDefNotFoundException on any call of a library project.
Not confirmed but I believe this is related to recent changes for maven support, also related to android studio preview
Similar change in the past
This reminds me of a similar change in the update to rev 17 where the lib folder suddenly changed to libs and all content from the original lib folder wasn't packaged so you wouldn't see any issues in eclipse. Only once installed on a device.
More information that 'issue' is available on this link. If you search on stackoverflow for "sdk 17" and "classdefnotfound' you'll also get enoug questions about that change.

Running Android project through Eclipse

I have a problem running my android project through eclipse. It gives following error when I try to run it:
trouble processing "javax/net/SocketFactory.class": ... Conversion to
Dalvik format failed with error 1
I am using Android 2.3.1 API level 9. The android.jar that is downloaded from AVD Manager has the javax/net package inside it.
I have searched on this issue and it seems to be the issue related to conversion of classes into Dalvik. But "javax/net/SocketFactory.class" is part of the android.jar. Any suggestions ?
The problem is resolved. I was mistakenly adding two android libraries at a time. One is added by default and other is added via Maven dependency. Removing the android dependency from pom.xml works. But now it is not working on terminal through mvn install command. This is a separate issue now.
As you know android sdk comes complete with java sdk build in. This sdk is light weight and customized for use by the dalvik engine. Now, if we also add java jar’s along with the android app, obviously the android system will have trouble converting that java jar to dalvik. Hence the “conversion to dalvik” issue.
So now that you know what happens, lets figure out why it happens.
In my case it was the barcode, zxing framework that caused the problem. You have to find out what is causing the issue in your setup.

Categories

Resources