dagger-android-sample icon indicating copy to clipboard operation
dagger-android-sample copied to clipboard

Updates for build.gradle and tested Proguard

Open jaredsburrows opened this issue 10 years ago • 11 comments

  • Updated buildToolsVersion in build.gradle
  • Updated com.android.tools.build:gradle in build.gradle
  • Updated Gradle wrapper
  • Added release to buildTypes enabling Proguard with minifyEnabled and shrinkResources which verifies: http://stackoverflow.com/questions/26024694/how-to-successfully-obfuscate-project-with-dagger-2-0-using-proguard

jaredsburrows avatar Nov 28 '14 04:11 jaredsburrows

@JakeWharton I have removed the extra task and used the release build type.

jaredsburrows avatar Nov 28 '14 05:11 jaredsburrows

Multidex works fine with Dagger 2. It just doesn't work with the current architecture. It would be trivial to alter the behavior.

JakeWharton avatar Nov 28 '14 05:11 JakeWharton

@JakeWharton You have used MultiDex + DI before? I have had issues with Roboguice + MultiDex in the past. What do you mean current architecture?

jaredsburrows avatar Nov 28 '14 05:11 jaredsburrows

The documentation for multidex states that you need to defer having classes loaded until the multidex classloader has been initialized. Otherwise the class will be in the wrong classloader and won't be available.

The current design forces Dagger classes to be loaded before the multidex classloader is initialized. This is the cause for the problems you are seeing.

However, I don't think we should attempt to showcase absolutely every feature of the Android build system in a single sample. Granular, explicit samples end up being much more effective in my experience. On Nov 27, 2014 9:06 PM, "Jared Burrows" [email protected] wrote:

@JakeWharton https://github.com/JakeWharton You have used MultiDex + DI before? I have had issues with Roboguice + MultiDex in the past. What do you mean current architecture?

— Reply to this email directly or view it on GitHub https://github.com/gk5885/dagger-android-sample/pull/3#issuecomment-64855369 .

JakeWharton avatar Nov 28 '14 05:11 JakeWharton

@JakeWharton I understand. I just wanted to be able to add Proguard to the working Android sample that uses Dagger 2.0. Should I remove the MultiDex line?

jaredsburrows avatar Nov 28 '14 05:11 jaredsburrows

Yeah let's remove it. We'll make another app sample somewhere to showcase multidex properly. On Nov 27, 2014 9:15 PM, "Jared Burrows" [email protected] wrote:

@JakeWharton https://github.com/JakeWharton I understand. I just wanted to be able to add Proguard to the working Android sample that uses Dagger 2.0. Should I remove the MultiDex line?

— Reply to this email directly or view it on GitHub https://github.com/gk5885/dagger-android-sample/pull/3#issuecomment-64855734 .

JakeWharton avatar Nov 28 '14 05:11 JakeWharton

  • Removed multidex
  • Updated commit message
  • Update pull request message

@JakeWharton Will you showcase Dagger 2.0 + MutliDex in a separate project soon? I was hoping to utilize both Proguard and MultiDex with Dagger 2.0.

jaredsburrows avatar Nov 28 '14 05:11 jaredsburrows

Proguard should work without any actual changes. But yeah we can make a multidex sample in the next week or so. We really should collect Dagger and all these samples into a GitHub org so they're in one place... On Nov 27, 2014 9:30 PM, "Jared Burrows" [email protected] wrote:

  • Removed multidex
  • Updated commit message
  • Update pull request message

@JakeWharton https://github.com/JakeWharton Will you showcase Dagger 2.0 + MutliDex in a separate project soon? I was hoping to utilize both Proguard and MultiDex with Dagger 2.0.

— Reply to this email directly or view it on GitHub https://github.com/gk5885/dagger-android-sample/pull/3#issuecomment-64856451 .

JakeWharton avatar Nov 28 '14 05:11 JakeWharton

@JakeWharton Yes! I saw you posted that somewhere. I agree and I would like to contribute.

You posted here: https://groups.google.com/forum/#!topic/dagger-discuss/q0AkspZ385c

jaredsburrows avatar Nov 28 '14 05:11 jaredsburrows

@gk5885 @JakeWharton Was there anything else that needed to change for this pull request?

jaredsburrows avatar Dec 05 '14 22:12 jaredsburrows

@gk5885 Any updates on this?

jaredsburrows avatar Jul 20 '16 05:07 jaredsburrows