So I'm fairly sure there is a multidex bug in the gradle plugin from an 
assumption of how project are laid out. I post this on the bug tracker in a 
bit but I wanted to post it here first. 

Imagine a project where your activities and services are actually being 
built in subprojects or in your jar dependencies and not in the top level 
app project. The Progaurd step to make the components.jar only passing in 
the jar for the current Gradle project but not all the dependent ones when 
it makes that components.jar. 

In BasePlugin.groovy after:
        ProGuardTask proguardComponentsTask = 
createShrinkingProGuardTask(project,
                    
"shrink${config.fullName.capitalize()}MultiDexComponents")

The proguard is step is only using:
      
 proguardComponentsTask.injars(pcData.inputFiles.call().iterator().next())

If your dependencies are the ones that have all your classes the step will 
just fail (with "java.io.IOException: The output jar is empty. Did you 
specify the proper '-keep' options?"). If you get it to sort of work by 
having just a single class reference work I believe that progaurd will not 
produce what you expect it to feed into the next step when it that private 
method in dx.


I think the entire process of asking Progaurd to shink may be an issue. I 
believe all dependencies should be added or that the allclasses.jar should 
be used instead. 

Also these two items are forced to always be added to the -keep list and 
they still warn with the same error:
Note: the configuration refers to the unknown class 
'android.app.backup.BackupAgent'
Note: the configuration refers to the unknown class 
'java.lang.annotation.Annotation'

Here is an example of what we see with the error in our cases:

:app:shrinkDebugMultiDexComponents
Executing task ':app:shrinkDebugMultiDexComponents' (up-to-date check took 
0.002 secs) due to:
  Input file 
/private/tmp/TestShit/app/build/intermediates/multi-dex/debug/allclasses.jar 
has changed.
  Input file 
/private/tmp/TestShit/app/build/intermediates/multi-dex/debug/manifest_keep.txt 
has changed.
ProGuard, version 4.11
Reading program jar 
[/private/tmp/TestShit/app/build/intermediates/multi-dex/debug/allclasses.jar]
Note: the configuration refers to the unknown class 
'com.apportable.app.VerdeApplication'
Note: the configuration refers to the unknown class 
'android.content.Context'
Note: the configuration refers to the unknown class 
'com.apportable.activity.VerdeActivity'
Note: the configuration refers to the unknown class 
'com.apportable.activity.GdbServerService'
Note: the configuration refers to the unknown class 
'com.apportable.media.AudioManagerService'
Note: the configuration refers to the unknown class 
'com.apportable.activity.ManageSpaceActivity'
Note: the configuration refers to the unknown class 
'com.apportable.notifications.NotificationsBootReceiver'
Note: the configuration refers to the unknown class 
'com.apportable.notifications.NotificationsAlarmReceiver'
Note: the configuration refers to the unknown class 
'com.apportable.notifications.LocalNotificationService'
Note: the configuration refers to the unknown class 
'com.apportable.iap.BillingService'
Note: the configuration refers to the unknown class 
'com.apportable.iap.BillingReceiver'
Note: the configuration refers to the unknown class 
'com.facebook.LoginActivity'
Note: the configuration refers to the unknown class 
'com.adjust.sdk.ReferrerReceiver'
Note: the configuration refers to the unknown class 
'com.mobileapptracker.Tracker'
Note: the configuration refers to the unknown class 
'com.amazon.device.ads.AdActivity'
Note: the configuration refers to the unknown class 
'com.google.android.gms.ads.AdActivity'
Note: the configuration refers to the unknown class 
'com.millennialmedia.android.MMActivity'
Note: the configuration refers to the unknown class 
'com.millennialmedia.android.VideoPlayerActivity'
Note: the configuration refers to the unknown class 
'com.rhythmnewmedia.sdk.RhythmActivity'
Note: the configuration refers to the unknown class 
'com.rhythmnewmedia.sdk.video.RhythmVideoActivity'
Note: the configuration refers to the unknown class 
'com.applovin.adview.AppLovinInterstitialActivity'
Note: the configuration refers to the unknown class 
'com.inmobi.androidsdk.IMBrowserActivity'
Note: the configuration refers to the unknown class 
'com.jirbo.adcolony.AdColonyOverlay'
Note: the configuration refers to the unknown class 
'com.jirbo.adcolony.AdColonyFullscreen'
Note: the configuration refers to the unknown class 
'com.jirbo.adcolony.AdColonyBrowser'
Note: the configuration refers to the unknown class 
'com.rfm.sdk.HTMLBrowserView'
Note: the configuration refers to the unknown class 
'com.mopub.common.MoPubBrowser'
Note: the configuration refers to the unknown class 
'com.mopub.mobileads.MoPubActivity'
Note: the configuration refers to the unknown class 
'com.mopub.mobileads.MraidActivity'
Note: the configuration refers to the unknown class 
'com.mopub.mobileads.MraidVideoPlayerActivity'
Note: the configuration refers to the unknown class 
'com.unity3d.ads.android.view.UnityAdsFullscreenActivity'
Note: the configuration refers to the unknown class 
'com.scopely.zendeskhelper.ui.RequestActivity'
Note: the configuration refers to the unknown class 
'com.scopely.zendeskhelper.ui.RequestCompletionActivity'
Note: the configuration refers to the unknown class 
'android.app.backup.BackupAgent'
Note: the configuration refers to the unknown class 
'java.lang.annotation.Annotation'
Note: android.support.multidex.MultiDexExtractor accesses a method 
'apply()' dynamically
Note: there were 39 references to unknown classes.
      You should check your configuration for typos.
      
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 1 accesses to class members by means of introspection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').
      
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
Note: You're ignoring all warnings!
:app:shrinkDebugMultiDexComponents FAILED
:app:shrinkDebugMultiDexComponents (Thread[main,5,main]) completed. Took 
0.122 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:shrinkDebugMultiDexComponents'.
> java.io.IOException: The output jar is empty. Did you specify the proper 
'-keep' options?

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug 
option to get more log output.

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adt-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to