Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - Gradle 1.5 --core-library option

I have a problem with my Android project and Gradle 1.5. I am not able to compile my dependencies I added. Currently I am developing an Java EE application and I want to perform an EJB lookup from my Android device to my running Wildfly10.

I know, doing a lookup from an android device might not be the best option, a REST webservice would be better, but thats not the point here.

In my project I added a new module, containing all my external libs, and I added this module to my :app as dependency on "compile" level. Everything just works fine, until I want to add the jboss-client.jar. During dex, he is complaining about the javax.transaction.*.

What I have done for now

  • added multiDexEnabled true
  • added preDexLibraries false
  • playing around with all other dex options
  • also I tried this: Android dx tool
  • this: Android Studio ignore --core-library flag
  • and set the --core-library flag in Android Studio settings

Why they are not working

    1. solution: I modified my dx.bat in every build-tool I have .. nothing changed. It's just not working
    1. solution: com.android.build.gradle.tasks.Dex is not known (and I have no idea how to add), coreLibrary is not supported with Gradle 1.5
    1. solution: is completely ignored by gradle

The projects minSDK is 19 and targetSDK is 23 with build-tool 23.0.2 I called the dx.bat from command-line with the same parameters as gradle, I only added the --core-library arg and it works! But that doesnt solve the problem within Android Studio and Gradle.

Can anyone please help me?

UPDATE: Okay, I had a look at the source code of com.android.dx.command.Main. There is a public inner class "Arguments" which contains (apperently) the arguments which can be used, also the coreLibrary=false. Now I only need to know how to modify it. Does anybody know?

Best regards, Chris

like image 205
Christoph Pölsterl Avatar asked Mar 11 '16 15:03

Christoph Pölsterl


People also ask

What is core library in Android?

The Mapbox Core Libraries for Android are a set of utilities that help you with permissions, device location, and connectivity within your Android project. With these libraries, you can: Check for, request, and respond to any number of Android system permissions such as device location or camera.

Where is Gradle settings in Android Studio?

Open your project in Android Studio and select File > Settings... > Build, Execution, Deployment > Build Tools > Gradle (Android Studio > Preferences... > Build, Execution, Deployment > Build Tools > Gradle on a Mac).


1 Answers

This worked for me:

 dexOptions {
    preDexLibraries = false
    additionalParameters =["--core-library"]
  }
like image 158
Yrlec Avatar answered Oct 02 '22 23:10

Yrlec