1

In my Android Studio project, I have a library module & a App module. Both use Gradle build.

MyProject
  -LibraryModule
    ...
    build.gradle
  -AppModule
   ...
   build.gradle
...
build.gradle

I need to get the classes.dex file of LibraryModule.

So, I run gradle's build task of LibraryModule in Android Studio, it was successful.

Then, I tried to find where is the generated classes.dex file, I only found one under MyProject/build/intermediates/dex/release/classes.dex , but it is an old file (Timestamp shows it was generated 2 days ago, I am not even sure how it has been generated.)

So, in Android Studio, where is the location for classes.dex? How can I generated it (if 'build' task doesn't generate it)?


Ok, this is weird, though build in Android Studio is successful, but when I try to build in command line under library module:

./gradlew build --stacktrace

I got following error:

Caused by: org.gradle.api.plugins.PluginInstantiationException: Could not create plugin of type 'LibraryPlugin'.
    at org.gradle.api.internal.plugins.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:67)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:103)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:68)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:34)

What does it mean "Could not create plugin of type 'LibraryPlugin'" ?

user842225
  • 5,445
  • 15
  • 69
  • 119

1 Answers1

1

Once the build is successfull with Gradle, the classes.dex is located here:

./YOURMODULE/build/intermediates/dex/YOURBUILDTYPE/classes.dex (buildType is usually debug or release).

This is true for Gradle 0.11.+ as of now.

shkschneider
  • 17,833
  • 13
  • 59
  • 112
  • hmmm...strange, my build was successful (I build my lib module by double click the 'build' task listed in Gradle window of Android Studio). THen, I open my project folder, the classes.dex displayed with date as two days ago... So, I feel the classes.dex is not generated – user842225 Nov 03 '14 at 15:57
  • AFAIK `classes.dex` holds references to resources of your APK. So it might not change from one build to another if you were just editing Java code (I might be wrong) - see https://stackoverflow.com/questions/14230573/role-of-classes-dex-file-in-an-apk-file – shkschneider Nov 03 '14 at 16:00
  • I updated my question, I run from commandline, it was failed. A weird error message is showing... – user842225 Nov 03 '14 at 16:02
  • Indeed, with an `android-library` Gradle-type project (library), I do not get a `classes.dex` file, but on the final project I do. Sorry, no `classes.dex` file for library project it seems... Can't help you more. – shkschneider Nov 03 '14 at 16:05