android - Gradle doesn't include module dependencies when executing `gradle clean assemble<BuildVarian>` -
I have a multi-module Android project. I have some input data for the environment:
Android Studio 1.0.1 Gredat 2.2.1 (Gredl rapper) Java Lk7k0_7l Android Gradl plugin 1.0.1 Kanpailsdike Virsian = 21 Bildtols Virsian = '21 .1.2 'MinSdkVersion = 14 targetSdkVersion = 21 When I run the project from Android Studio, the app is executed and executed properly on the device Land (for all build variants). But when I try to clear the gather from the terminal ./ gradlew, then debug the file or any other build version (I have 4: debug, alpha, beta , Release) is successful but when I crash it with any code defined in the module project with java.lang.NoClassDefFoundError , then I try to run it.
I have excluded ProGuard as a suspect because it only runs on the release verion but this problem is consistent with all the construction.
In addition, I have checked that the module does not include repeated dependencies.
Edit
A positive stack trace:
9553-9 553 / my.package.app e / Android Rentman: fatal exception: the main process: my.package.app, PID: my.package.module1.Go on 9553 java.lang.NoClassDefFoundError: my.package.app.MyApplication.onCreate (MyApplication.java:59) On android.app On android.app.ActivityThread.access $ 1600 on Instrumentation.callApplicationOnCreate (Instrumentation.java:1013) android.app.ActivityThread.handleBindApplication (ActivityThread.java:4729) (ActivityThread.java:174) on android.app.ActivityThread $ H . handleMessage (ActivityThread.java:1367) android.os.Handler.dispatchMessage (Handler.java:102) android.os.Looper.loop (Looper.java:146) On android.app.ActivityThread.main (ActivityThread.java : 5593) on java.lang.reflect.Method.invoke native (native Method) java.lang.reflect.Method.invoke (method.java / 15) on com.android.internal.os.ZygoteInit ndArgsCaller.run at $ MethodA (ZygoteInit.java:1283) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1099) dalvik.system.NativeStart.main (Native Method) As you are viewing, the class go is a part of the package my.package.module1 defined in a sub module : module1 Is (see creation Crypt source).
Part of shield build:
buildscript {repositories {mavenCentral ()} dependency {classpath 'com.jakewharton.sdkmanager: gradle-plugin: 0.12. + '}} Apply the plugin: Apply the' android-sdk-manager 'plugin:' com.android.application 'android {// ... // compilation and device version default config {// target SDK and so on applicationYou Other stuff about 'My Package.app' // ... // version} Collections ideas {sourceCompatibility JavaVersion.VERSION_1_7 target conformance JavaVersion.VERSION_1_7} buildTypes {release {// ...} alpha {// ...} Beta {// ...} debug {// ...}} Packaging Options (Exclude 'Meta-INF / Defendes' 'Meta-INF / Notice' Meta-INA / License out 'META-INF / Elaisianteepitik' the 'meta-Aianaf / Notisktekst'}} dependencies do not put out {// ... // Standart dependencies such support Lib and other Kanpaill project ( 'module 1 ') compile project (': Module 2 ') compile project (': module 3 ') / / other module}
After playing with build scripts and by the way collecting a build with the terminal Obtained by comparison I stumbled over differences:
- Project it
Generate and LT for all module projects; BuildWeerian & gt; The sourceandcreated & lt; BuildVarian & gt; Test sources execute (it is determined in such a way that it is always executed before running the ED command before running the AD command)- Terminal to
./ Gradlew collects faster DebuggingIt grows rapidly so that gradually the sub modules exported on time do not bring the ARS. There may be a bug in Gradle 2.2 (2.2.1) or the Android Gradle plugin - I do not remember having issues with previous versions like this- when running
./ gradlew clean generateDebugSources generateDebugTestSources assembleDebug < / Code> The problem is still in place - it may also be related to the bug. - Terminal to
Temporary Solution
Perform the following sequence sequentially: generate and generate lt sources;
Generate #lt ./gradlew; BuildVariant & gt BuildVariant & gt; TestSources # ... Work generation # ... # ./gradlew collect & lt; BuildVariant & gt; In this way production APC is assembled with all the module projects
Launterom solution
An issue Ticket removed
Comments
Post a Comment