Can't generate signed APK in Android Studio, 'java.io.IOException'

北城以北 提交于 2019-12-05 16:19:13

Did you tried to disbale proguard for release build?

release {
    shrinkResources false
    minifyEnabled false
    useProguard false
    multiDexEnabled true
    proguardFiles getDefaultProguardFile('proguard-android.txt'), "proguard-rules.pro"
}

if this works, you should fix our proguard config

Try excluding answers-shim:

compile ('io.branch.sdk.android:library:2.+') {
    exclude module: 'answers-shim' 
}

Try to add below line in your proguard file to ignore warning that you are getting as above.

-dontwarn com.crashlytics.android.answers.shim.**

The problem was in answers library. There seems to be a problem in the latest version. When i downgrade the library to

compile('io.branch.sdk.android:library:2.5.9') { exclude module: 'answers-shim' }

it works fine.

Problem

The same problem occurred to me after I :

  • Upgraded to Android Studio 3, then
  • in my dependency library, changed inline classes to lambdas and method references.

I thought I could freely utilize lambdas and method references as stated in Android Studio 3 release notes, I may have forgot or missed it.

Solution:

Anyway, I'm not 100% sure, but I think we still can't use lambdas and/or method references in project libraries, because as soon as I reverted all lambdas and method references in my library, I successfully re-generated my APK.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!