无法在发布版本中构建apk

时间:2017-02-06 08:49:46

标签: android lambda android-proguard

当我在调试版本中部署apk时没有警告,但是当我尝试在发布版本中构建apk时,我收到了此警告,请任何人帮忙。

Warning:com.jjf2017.activity.MainActivity$43$$Lambda$1: can't find referenced class java.lang.invoke.LambdaForm$Hidden Warning:com.jjf2017.fragment.ArtistIDFragment$$Lambda$1: can't find referenced class java.lang.invoke.LambdaForm$Hidden Warning:com.jjf2017.fragment.ArtistIDFragment$$Lambda$2: can't find referenced class java.lang.invoke.LambdaForm$Hidden Warning:com.jjf2017.fragment.ArtistINFragment$$Lambda$1: can't find referenced class java.lang.invoke.LambdaForm$Hidden Warning:com.jjf2017.fragment.ArtistINFragment$$Lambda$2: can't find referenced class java.lang.invoke.LambdaForm$Hidden Warning:com.jjf2017.fragment.CcFragment$$Lambda$1: can't find referenced class java.lang.invoke.LambdaForm$Hidden Warning:com.jjf2017.fragment.TicketFragment$$Lambda$1: can't find referenced class java.lang.invoke.LambdaForm$Hidden Warning:org.joda.time.DateMidnight: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.DateTime: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.DateTimeZone: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.DateTimeZone: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.Days: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Days: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.Duration: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Hours: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Hours: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.Instant: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.LocalDate: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.LocalDate: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.LocalDateTime: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.LocalDateTime: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.LocalTime: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.LocalTime: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.Minutes: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Minutes: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.MonthDay: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.MonthDay: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.Months: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Months: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.MutableDateTime: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.MutablePeriod: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Period: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Seconds: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Seconds: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.Weeks: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Weeks: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.YearMonth: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.YearMonth: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.Years: can't find referenced class org.joda.convert.FromString Warning:org.joda.time.Years: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.base.AbstractDateTime: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.base.AbstractDuration: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.base.AbstractInstant: can't find referenced class org.joda.convert.ToString Warning:org.joda.time.base.AbstractPeriod: can't find referenced class org.joda.convert.ToString Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup Warning:retrofit2.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement Warning:there were 52 unresolved references to classes or interfaces. Warning:Exception while processing task java.io.IOException: Please correct the above warnings first. Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. Job failed, see logs for details

2 个答案:

答案 0 :(得分:1)

错误:任务执行失败':app:transformClassesAndResourcesWithProguardForRelease'表示 你在发布中使用proguard。

尝试将build.gradle文件中的minifyEnabled选项设置为false。

像这样:

buildTypes {
        release {
            minifyEnabled false
            ...
        }
    }

答案 1 :(得分:0)

如果您的应用在制作时仍然有效

  

minifyEnabled false

然后你必须手动警告你对-dontwarn

的每一个警告

示例:-dontwarn java.lang.invoke.**